How to change GridView column size in YII?

gridview, php, width, yii

Solution

If you do not want to use a separated CSS definition you should do:

'htmlOptions' => array('style' => 'width: 30px;'),
'filterHtmlOptions' => array('style' => 'width: 30px;'),

Problem

Im trying change my GridView column width. This is my code: ``` <?php $this->widget('zii.widgets.grid.CGridView', array( 'id' => 'prefixs-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array( array( 'name' => 'id', 'header' => 'No.', 'htmlOptions' => array('class' => 'center'), ), array( 'name' => 'pfx', 'htmlOptions' => array('width' => 30), ), array( 'class' => 'CButtonColumn', ), ), )); ?> ``` When i run 'pfx' columns width must be changed to 30, but width is same. How i can change width of column? Any ideas?

Original source

Related problems