You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all Hi to all!
I have problems with Ajax loaded datagrid.
I have a form with 4 filter fields (City, Name, etc) and when I submit the form all goes well: datagrid was loaded and correctly filtered.
But when I use pager the page reloads (obviously without themes) and the filters are cleared (i.e. the grid show me all values).
I try to change pager in this way (I report only the modified part of it):
sendRequest is a jscript that simply send an XMLHttpRequest and fill the #output tag with the results (i.e. the Datagrid).
In this way the datagrid loaded correctly and page is not reloaded, but not filtered, completely resetted and page counter remain on 1 and doesn't change. I want that the filters remain the same and the page goes to next or previous value.
I have not yet implemented the column ordering, but I suppose that I will have the same problem.
Can you help me?
Thank you!
The session of the grid is killed if the referer isn't set or different from the grid url without query string.
I think a default XMLHttpRequest doesn't add the referer. You have two work arounds:
Sets the referer of your request with x.setRequestHeader("Referer", <grid_url>);
Sets to true the persistence of the session with $grid->setPersistence(true); But if you do that the grid is only reset if you kill your session by closing your webbrowser or by killing the cookie)
Try the second solution, and if it's worked, use the first solution.
I'll try later to add a condition for an XMLHttpRequest.
If I set the grid persistence to true the pager works, but filters are resetted.
Because of my lack of knowledge of javascript and jquery do not know where and how to properly set the referer.
Ok, I've set the referer but the things remains the same.
If I set the referer and I do not set the persistence, nothing happens, however the grid reload completely, without filters.
Thanks anyway!
Thank you so much!
I used a personalized filter form that filtered directly the source of the datagrid.
Instead I've missed to overwrite datagrid filters with:
Activity
Abhoryo commentedon May 25, 2012
The session of the grid is killed if the referer isn't set or different from the grid url without query string.
I think a default XMLHttpRequest doesn't add the referer. You have two work arounds:
Try the second solution, and if it's worked, use the first solution.
I'll try later to add a condition for an XMLHttpRequest.
morferic commentedon May 25, 2012
Thank you.
I will try these solutions!
Eric
morferic commentedon May 25, 2012
If I set the grid persistence to true the pager works, but filters are resetted.
Because of my lack of knowledge of javascript and jquery do not know where and how to properly set the referer.
morferic commentedon May 25, 2012
Ok, I've set the referer but the things remains the same.
If I set the referer and I do not set the persistence, nothing happens, however the grid reload completely, without filters.
Thanks anyway!
Abhoryo commentedon May 25, 2012
Do you use isReadyForRedirect ?
Abhoryo commentedon May 25, 2012
If you want to work, add a condition in line 227 of the grid.php file :
Or download the last version.
And don't use isReadyForRedirect().
Abhoryo commentedon May 25, 2012
My working test:
My controler:
My list template:
My ajax template:
morferic commentedon May 31, 2012
Thank you so much!
I used a personalized filter form that filtered directly the source of the datagrid.
Instead I've missed to overwrite datagrid filters with:
Because the Datagrid template I used is very complicated, I have extended the template in another file with:
and all goes well.
Thank you.
Eric