FosAvance
FosAvance

Reputation: 2469

Add class to textbox in CGridView

As you know in CGridView there is textbox which allows to filter data. How to add class to those textbox, like: <input type="text" class="">

enter image description here

Upvotes: 3

Views: 2271

Answers (1)

deacs
deacs

Reputation: 4309

Taken from the forum:

$this->widget('zii.widgets.grid.CGridView', array
    (
            'id'=>'your-grid',
            'dataProvider'=>$model->search(),
            'filter'=>$model,
            'columns'=>array
            (
                    'ID',
                    array
                    (
                            'name'=>'attr',
                            'filter'=>CHtml::textField('attr', '', array('class'=>'asdf')),
                    ),
                    ..
            ),
    ));

Upvotes: 5

Related Questions