Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add class to textbox in CGridView

Tags:

yii

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

like image 396
FosAvance Avatar asked Jan 28 '26 20:01

FosAvance


1 Answers

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')),
                    ),
                    ..
            ),
    ));
like image 178
deacs Avatar answered Jan 31 '26 19:01

deacs



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!