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.
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:
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 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…
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.
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.
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.