Skip to content

Commit aa08502

Browse files
Merge pull request #169 from heyday/4
FIX broken URL builder when using MultiSelectFields as parameters
2 parents 03869a7 + a25d043 commit aa08502

File tree

1 file changed

+28
-13
lines changed

1 file changed

+28
-13
lines changed

javascript/ReportAdmin.js

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,32 @@
22
* File: ReportAdmin.js
33
*/
44

5-
(function($) {
6-
$.entwine('ss', function($){
7-
$('.ReportAdmin .cms-edit-form').entwine({
8-
onsubmit: function(e) {
9-
var url = $.path.parseUrl(document.location.href).hrefNoSearch,
10-
params = this.find(':input[name^=filters]').serializeArray();
11-
params = $.grep(params, function(param) {return (param.value);}); // filter out empty
12-
if(params) url = $.path.addSearchParams(url, $.param(params));
13-
$('.cms-container').loadPanel(url);
14-
return false;
15-
}
16-
});
17-
});
5+
(function ($) {
6+
$.entwine("ss", function ($) {
7+
$(".ReportAdmin .cms-edit-form").entwine({
8+
onsubmit: function (e) {
9+
let url = $.path.parseUrl(document.location.href).hrefNoSearch;
10+
let params = this.find(":input[name^=filters]").serializeArray();
11+
12+
try {
13+
params = $.grep(params, function (param) {
14+
// filter out empty
15+
return param.value;
16+
});
17+
18+
// convert params to a query string
19+
params = $.param(params);
20+
21+
// append query string to url
22+
url += "?" + params;
23+
24+
$(".cms-container").loadPanel(url);
25+
} catch (err) {
26+
console.error(err);
27+
}
28+
29+
return false;
30+
},
31+
});
32+
});
1833
})(jQuery);

0 commit comments

Comments
 (0)