BUGFIX Include GET parameters of current URL in GridField on ajax reloads to retain view state

This commit is contained in:
Ingo Schommer 2012-03-02 20:27:13 +01:00
parent 02e728fa08
commit b242bfb3da
2 changed files with 9 additions and 0 deletions

View File

@ -387,6 +387,9 @@ jQuery.noConflict();
*/ */
$('.cms .ss-gridfield').entwine({ $('.cms .ss-gridfield').entwine({
showDetailView: function(url) { showDetailView: function(url) {
// Include any GET parameters from the current URL, as the view state might depend on it.
// For example, a list prefiltered through external search criteria might be passed to GridField.
if(window.location.search) url += window.location.search;
$('.cms-container').entwine('ss').loadPanel(url); $('.cms-container').entwine('ss').loadPanel(url);
} }
}); });

View File

@ -11,6 +11,12 @@
if(!ajaxOpts.data) ajaxOpts.data = []; if(!ajaxOpts.data) ajaxOpts.data = [];
ajaxOpts.data = ajaxOpts.data.concat(data); ajaxOpts.data = ajaxOpts.data.concat(data);
// Include any GET parameters from the current URL, as the view state might depend on it.
// For example, a list prefiltered through external search criteria might be passed to GridField.
if(window.location.search) {
ajaxOpts.data = window.location.search.replace(/^\?/, '') + '&' + $.param(ajaxOpts.data);
}
form.addClass('loading'); form.addClass('loading');
$.ajax($.extend({}, { $.ajax($.extend({}, {