$.fn.yiiGridView.update doesn't work after paginate

Hi, maybe this happened to someone before.

When calling to $.fn.yiiGridView.update after paginating I get an error:

settings is undefined


Line 126

After doing some research with firebug it seams that the ["$.fn.yiiGridView.settings"] array doesn’t get populated with the new page records. It keeps the old data.

Thanks in advance for any ideas.

Something more, the grid is inside a partial rendered by a listview

Someone please?

Did you provide the right id of your grid when you called update() (Withouth ‘#’)?


Yes I did. I’m sure. It works perfectly at first, only fails after changing the page.

Debuging with firebig I noticed that an array containing what seems to be each of the grids doesn’t get loaded with the new objects ("$.fn.yiiGridView.settings").

That’s strange. Did you maybe disable AJAX updates (‘ajaxUpdate’=>false)? Actually the js settings are only set when the grid is initialized after the page has loaded. Any subsequent AJAX request should not change the stored settings for the grid.

Hello Mike, sorry for the delay. Ajax is activated. It seams to me that, as you said, the array is loaded only the first time (if I understood correctly).

Do you know if there is a way to refresh the data in “$.fn.yiiGridView.settings”, I don’t know what to try next :(


Yes, only the grid gets replaced after an ajax call.

The settings should still be there because the page is not reloaded at all. So maybe do some more debugging with firebug. I would check what’s happening in line 33 when the page is loaded. That’s where the settings are stored:

$.fn.yiiGridView.settings[id] = settings;

Maybe you find out, why they seem to disappear.

I’ll do some more debugging Mike. The settings does not disappear, they keep the data from the first loading, all data from the grids from the first load are still there, they don’t refresh with the grids from the new page.

If someone has some idea to try please tell me.


If all settings are there, then it doesn’t explain the error from your intitial post:

That’s why i suggested to e.g. compare the two ids used in line 33 and line 125 when writing and reading the settings.

BTW: Why are you calling $.fn.yiiGridView.update() at all? Pagination clicks are usually handled automatically by the gridview. No need to manually trigger update() again…

Hi Mike, sorry for the delay.

I call update because the user adds a record in one of the rendered grids, remember that there are several grids rendered in a listview, so in one page of the listview several grids are redered.


So you have CGridViews inside the itemViews of a CListView?

It would help if you could create a boiled down and simplified example that still has the issue.

Ok, I’ll do that later today, thanks for your help Mike

I have the same issue with CGridView.

I use Gii to generate Admin form that included a CGridView (with default settings).

Then I do following actions:

  1. Do search with a filter value => everything is ok.

  2. Clear the filter, then the grid reload with all values => Ok.

  3. go to second page of grid, the the grid loads values => Ok.

  4. Input previous filter value , then the grid display "loading…" message, but it clears the filter value without searching => not OK.

is this an error of CGridView?

I have the same question.

When you yiiGridView.update,you can set the options url as the search form like this:

$.fn.yiiGridView.update(‘news-grid’, {

	url:  $('#yw0').attr('action'),

	data: $(this).serialize()


I had the same error, $.fn.yiiGridView.settings[‘mygrid’] was empty and raised an error.

I had a view with a form, with a cgridview (mygrid). Then I had a link that opens a Modal Dialog with an update, this form ALSO had a grid (for a diferent model). As soon as the Modal Dialog is rendered the setting attribute get unreachable.

I found the cause (for my particular case) and solved the issue:

The CGridView was loading "jquery.yiigridview.js" in the main form, and the again in the modal popup.

I solved it with this code:

<?php if (Yii::app()->request->isAjaxRequest){

Yii::app()-&gt;clientscript-&gt;scriptMap['jquery.js'] = false; 

Yii::app()-&gt;clientscript-&gt;scriptMap['jquery-ui.min.js'] = false; 

Yii::app()-&gt;clientscript-&gt;scriptMap['jquery.yiigridview.js'] = false; 


You have to check what JS files are you including to avoid duplicated calls. Also get sure about the JS file loaded in the main page, if the JS is not present in the main page, and you explicitly deny the JS load in the popup… you will not have the js code in nowhere.

I hope that helps someone =)