I am extending CGridView in Yii using jQuery to remember the checked rows when switching pages. The pages are loaded using AJAX, so i thought that when the request is finished and the new page is rendered, i want my code to step in an do it's magic. However, i can't seem to find any documentation that indicates any event being fired or so when the new page is finished rendering.
I could however use DOM listeners but i figured it would be better to use one event for the whole page.
You can use afterAjaxUpdate
(since your pages are loaded with ajax):
$this->widget('zii.widgets.grid.CGridView', array(
// ... options ...
'ajaxUpdate'=>true,
'afterAjaxUpdate'=>'aFunctionThatWillBeCalled', //
// ... more options ...
));
You can add the js function like so:
Yii::app()->clientScript->registerScript('some-script-id','function aFunctionThatWillBeCalled(id, data){
console.log("id is "+id);
// your jquery code to remember checked rows
}');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With