CGridView is way too limited.


I went through the CGridView documentation and i saw that it is limited to an AR object only. What if i have an array i would like to sort it with? I am pretty sure that the same functionality can be done using an array with some small modification.

Did anyone found something or can say how to use the CGridView without an AR object but an array?


I think you can use CDataProvider to work with pure arrays for example.

Try this extension

I did and it does work, But for some reason it won’t show the paginate links, Despite the fact that it does limit the grid to just 20 rows out of the 100 i have, it won’t sort using the headers as the CSort uses an AR as well.

Ok, Managed to figure everything out. Now how can i make it that the pager links will use AJAX isntead of refreshing the page?


MY code:

$this->widget('zii.widgets.grid.CGridView', array(



                    'ajaxUpdate' => 'results-query',

                    'nullDisplay' => '--',

                    'pager' => array('pageSize'=>20, 'maxButtonCount'=>10, 'actionPrefix' => 'LoadQuery'),

                    'rowCssClass'=> array('acp-row-on', 'acp-row-off'),