Revision #5 has been created by xrx on Jun 19, 2012, 9:16:36 PM with the memo:
CListView tested in meanwhile so I changed title and last sentence
« previous (#4)
Changes
Title
changed
Avoiding rendering entire page when using CGridView and CListView via AJAX
Category
unchanged
How-tos
Yii version
unchanged
Tags
unchanged
CGridView, AJAX, render, CListView, Interactions
Content
changed
[...]
So in index view, put _$this->_getGridViewPost()_ in place where you want your CGridView. In _ _getGridViewPost_ method, create your dataProvider and call _$this->renderPartial()_ of view where you have your CGridView widget.
That's it! On first request, everything works as normal but when you interact with CGridView, filter intercepts request and call only method that is related to CGridView. This also satisfies **Convention Over Confituration** thing. Method with CGridView must have name _getGridView{$ajaxVar} where {$ajaxVar} is widget ID (which is passed by $_GET['ajax']).
Also, in theory, this should work in CListView too but I didn't try it to be honest :)This thing also works for CListView in very similar way.