Cgridview And Ccheckbox Ajax Loading Issue

Hi All,

I’m loading a page in lightbox using ajax, The page contains CGridview and in CGridview I have one column for CCheckbox. CGridview is managing everything for these checkboxes, it is showing 'selectAll" checkbox also for selecting all checkboxes also (As i have set “selectedRows=2”), But the issue is: When i first load the cgridview using ajax it works fine, but when i close the lightbox and again load the cgridview than i’m not able to select/check any checkbox due to below reason:

CGridview again binds the click event with each checkbox, so when i click on it, than it checks it and unchecks it again. So double click fires on each click. It works fine if I open it again because than it binds three events on it. It means it works fine in odd cases and not in even cases.

I can’t make the random id of the cgridview because I have implemented a search in which i’m refreshing that cgridview. To refresh that cgridview, I need the id of the cgridview to pass in the yii default function (shown below):



	var ajaxRequest = $('#addReqItems').serialize();

[size=2]        var gridview=$.fn.yiiGridView;[/size]

[size=2]    [/size][size=2]	[/size][size=2]gridview.update([/size]


         	{data: ajaxRequest}




Moreover, default pagination does not work, if we make the ID of cgridview dynamic. :( So i can’t make it dynamic.

I don’t know how to resolve it. Can anyone guide me on this.


Ravi Verma

Try this with IFrame

I have resolved it in Native Approach also by using below code in "CGridView":

'itemsCssClass'=>'items '.$dynamicTableClass,

In above you also be sure, that the $dynamicTableClass should not be changed if the request is a pagination request.


Ravi Verma