Difference between #4 and #5 of
Avoiding rendering entire page when using CGridView and CListView via AJAX

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.
23 0
29 followers
Viewed: 51 635 times
Version: 1.1
Category: How-tos
Written by: xrx
Last updated by: xrx
Created on: Mar 24, 2011
Last updated: 11 years ago
Update Article

Revisions

View all history