输出设置小部件CGrdiView(Yii)

I need to make some changes in the output of the widget CGrdiView, namely:

  • Swap the input box search field, and the field name;
  • Reduce the width of the column;

I do not know how to do.

Screenshot link >>

enter image description here

Not sure about switching in the input box and the field name but you can easily reduce the width of the column:

$this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'user-grid',
    'dataProvider'=>$model->search(),
    'filter'=>$model,
    'columns'=>array(
            array(
                    'name' => 'id',
                    'htmlOptions' => array('style'=>'width: 30px;'),
            ),
            //rest of your code

Found how to switch them by looking at documentation just do this:

$this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'user-grid',
    'dataProvider'=>$model->search(),
    'filter'=>$model,
    'filterPosition' => 'header', //ADD THIS LINE

FYI here is the documentation: http://www.yiiframework.com/doc/api/1.1/CGridView