Skip to content

Commit

Permalink
Merge pull request #169 from heyday/4
Browse files Browse the repository at this point in the history
FIX broken URL builder when using MultiSelectFields as parameters
  • Loading branch information
GuySartorelli authored Sep 25, 2023
2 parents 03869a7 + a25d043 commit aa08502
Showing 1 changed file with 28 additions and 13 deletions.
41 changes: 28 additions & 13 deletions javascript/ReportAdmin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

0 comments on commit aa08502

Please sign in to comment.