Hi
I have one table which records I would like to display in a gridview but without using pagination and keeping the filter and sorting functionalities.
If I use CActiveDataProvider I can set the
$dataProvider->pagination->pageSize = $model->count()
but I loose the filtering capabilities because an error message is displayed saying: [color="#0000FF"]CActiveDataProvider does not have a method named "getValidators".[/color]
In this case, if I set the CGridView->filter property to $model no errors are shown, but the filters do not work.
Example:
$dataProvider = new CActiveDataProvider($model);
/* The idea is to show all the table's records in the gridView without using the pager */
$dataProvider->pagination->pageSize = $model->count();
$this->widget('zii.widgets.grid.CGridView',
array(
'id'=>'contact-grid',
'dataProvider'=>$dataProvider, // This helps to establish the pageSize property.
'filter'=>$model, // This keeps the filters in the gridview but don't work.
'selectableRows'=>1,
'enableSorting'=>true,
'summaryText' => '{count} records(s) found.',
'columns'=>array(...
I wish to have filtering and sorting capabilities (as in any normal gridView) and show all the records with a code like this:
$contacts = new Contact;
$dataProvider = new CActiveDataProvider('Contact');
$dataProvider->pagination->pageSize = $contacts->count();
$this->widget('zii.widgets.grid.CGridView',
array(
'id'=>'contact-grid',
'dataProvider'=>$dataProvider,
'filter'=>$dataProvider,
'selectableRows'=>1,
'enableSorting'=>true,
'enablePagination'=>false,
'summaryText' => '{count} records(s) found.',
'columns'=>array( ...
but this approach generates the error: [color="#0000FF"]CActiveDataProvider does not have a method named "getValidators".[/color]
Is there any way to show all the records in a gridView without using pagination?
Any ideas?