Hi, I’ve noticed that in some examples there is an AJAX search bar in top of items of CGridView, but mine is not getting displayed (bootstrap widget).
How can I render it? Which methods should I implement?
Thanks!
Hi, I’ve noticed that in some examples there is an AJAX search bar in top of items of CGridView, but mine is not getting displayed (bootstrap widget).
How can I render it? Which methods should I implement?
Thanks!
It works by default if you use a active record model.
Also you have to use
‘filter’=>$model,
on the widget
$config = array(
array(
'name' => 'name',
'header' => 'Name',
'filter' => true, // enable filter for the number field. Default value is true
),
array(
'name' => 'number',
'header' => 'Number',
'filter' => false, // disable filter for the number field
),
);
$dataProvider_all = $this->widget('bootstrap.widgets.TbGridView', array(
'dataProvider'=>$model->search(),
'filter'=>$model,
'type'=>'striped bordered',
'template' => "{items}",
'columns' => $config,
), true );
echo $dataProvider_all ;
Excellent, thanks!
I haven’t noticed that search() returned a CActiveDataProvider and I was instantiating one apart.
But what was really needed was the ‘filter’ thing.
Thanks!
Thanks jneto