From 32136305be887fe3118f078c3f73df569c86ca53 Mon Sep 17 00:00:00 2001 From: Igor Date: Thu, 22 May 2014 12:39:32 +1200 Subject: [PATCH] BUG fix listview not working with IE9 To reproduce: 1. Using IE9, go to demo.silverstripe.com 2. login 3. go to Pages 4. switch to listview 5. expand pages to get to one with pagination (e.g. Pages > Features > Listview) 6. go to next page Expected: you go to the next page Actual: it jumps you back to the home page Fix: this fix passes parameters stored in the hash part of the url, which IE9 and below rely on for PJAX. --- javascript/GridField.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/javascript/GridField.js b/javascript/GridField.js index 746f6fbf6..cd08d31be 100644 --- a/javascript/GridField.js +++ b/javascript/GridField.js @@ -22,6 +22,14 @@ if(window.location.search) { ajaxOpts.data = window.location.search.replace(/^\?/, '') + '&' + $.param(ajaxOpts.data); } + + // For browsers which do not support history.pushState like IE9, ss framework uses hash to track + // the current location for PJAX, so for them we pass the query string stored in the hash instead + if(!window.history || !window.history.pushState){ + if(window.location.hash && window.location.hash.indexOf('?') != -1){ + ajaxOpts.data = window.location.hash.substring(window.location.hash.indexOf('?') + 1) + '&' + $.param(ajaxOpts.data); + } + } form.addClass('loading');