BUG GridField action onclick assuming URL without "?" character

Sometimes GridState URL will have a query string already appended,
e.g. "?local=en_GB", but the GridField javascript assumes there won't
be.

The result would be an action URL like:
"/my/url?locale=en_US?RelatedPage=123" which is obviously invalid.

The fix is to check that "?" exists in the GridState URL and use
"&" instead to connect the URLs if that's the case.
This commit is contained in:
Sean Harvey 2013-05-15 15:39:28 +12:00
parent 7bf790a5fa
commit 9f532fe976

View File

@ -170,8 +170,11 @@
data = window.location.search.replace(/^\?/, '') + '&' + data;
}
// decide whether we should use ? or & to connect the URL
var connector = grid.data('url').indexOf('?') == -1 ? '?' : '&';
var url = $.path.makeUrlAbsolute(
grid.data('url') + '?' + data,
grid.data('url') + connector + data,
$('base').attr('href')
);
@ -215,8 +218,11 @@
data = window.location.search.replace(/^\?/, '') + '&' + data;
}
// decide whether we should use ? or & to connect the URL
var connector = grid.data('url').indexOf('?') == -1 ? '?' : '&';
window.location.href = $.path.makeUrlAbsolute(
grid.data('url') + '?' + data,
grid.data('url') + connector + data,
$('base').attr('href')
);
@ -357,4 +363,4 @@
}
});
});
}(jQuery));
}(jQuery));