diff --git a/assets/datagrid.js b/assets/datagrid.js index 6788cecb..b1eb4a47 100644 --- a/assets/datagrid.js +++ b/assets/datagrid.js @@ -347,27 +347,33 @@ document.addEventListener('change', function(e) { } }); - window.datagridSerializeUrl = function(obj, prefix) { -var str = []; -for(var p in obj) { - if (obj.hasOwnProperty(p)) { - var k = prefix ? prefix + "[" + p + "]" : p, v = obj[p]; - if (v !== null && v !== "") { - if (typeof v == "object") { - var r = window.datagridSerializeUrl(v, k); + var str = []; + let urlPathForPersistentChecking = window.location.pathname; + + for (var p in obj) { + if (obj.hasOwnProperty(p)) { + var k = prefix ? prefix + "[" + p + "]" : p, v = obj[p]; + if (v !== null && v !== "") { + // fix for persistent nette parameters + if (urlPathForPersistentChecking.includes('/' + v)) { + urlPathForPersistentChecking = urlPathForPersistentChecking.replace('/' + v, ''); + continue; + } + if (typeof v == "object") { + var r = window.datagridSerializeUrl(v, k); if (r) { str.push(r); } - } else { - str.push(encodeURIComponent(k) + "=" + encodeURIComponent(v)); + } else { + str.push(encodeURIComponent(k) + "=" + encodeURIComponent(v)); + } } } } -} -return str.join("&"); -} -; + + return str.join("&"); +}; datagridSortable = function() { if (typeof $.fn.sortable === 'undefined') {