FIX broken URL builder when using MultiSelectFields as parameters

This commit is contained in:
Will Rossiter 2023-09-21 06:41:00 +12:00 committed by Will Rossiter
parent 03869a7535
commit a25d0432c4
No known key found for this signature in database
GPG Key ID: 7FD2A809B22259EF

View File

@ -2,17 +2,32 @@
* File: ReportAdmin.js
*/
(function($) {
$.entwine('ss', function($){
$('.ReportAdmin .cms-edit-form').entwine({
onsubmit: function(e) {
var url = $.path.parseUrl(document.location.href).hrefNoSearch,
params = this.find(':input[name^=filters]').serializeArray();
params = $.grep(params, function(param) {return (param.value);}); // filter out empty
if(params) url = $.path.addSearchParams(url, $.param(params));
$('.cms-container').loadPanel(url);
return false;
}
});
});
(function ($) {
$.entwine("ss", function ($) {
$(".ReportAdmin .cms-edit-form").entwine({
onsubmit: function (e) {
let url = $.path.parseUrl(document.location.href).hrefNoSearch;
let params = this.find(":input[name^=filters]").serializeArray();
try {
params = $.grep(params, function (param) {
// filter out empty
return param.value;
});
// convert params to a query string
params = $.param(params);
// append query string to url
url += "?" + params;
$(".cms-container").loadPanel(url);
} catch (err) {
console.error(err);
}
return false;
},
});
});
})(jQuery);