diff --git a/admin/javascript/LeftAndMain.js b/admin/javascript/LeftAndMain.js index 06b5d6b66..74e8a05a3 100644 --- a/admin/javascript/LeftAndMain.js +++ b/admin/javascript/LeftAndMain.js @@ -387,6 +387,9 @@ jQuery.noConflict(); */ $('.cms .ss-gridfield').entwine({ 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); } }); diff --git a/javascript/GridField.js b/javascript/GridField.js index 24f76ec1f..eb42af07a 100644 --- a/javascript/GridField.js +++ b/javascript/GridField.js @@ -11,6 +11,12 @@ if(!ajaxOpts.data) ajaxOpts.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'); $.ajax($.extend({}, {