mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
7bf790a5fa
commit
9f532fe976
@ -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')
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user