Skip to content

Commit ee54b5c

Browse files
committed
Fix urlFilterApplier for filter values as array
1 parent 9b0e514 commit ee54b5c

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

app/code/Magento/Ui/view/base/web/js/grid/url-filter-applier.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ define([
6666
if (item && item.search(this.filterKey) !== -1) {
6767
itemArray = item.split('=');
6868

69+
if (itemArray[1].search('\\[') === 0) {
70+
itemArray[1] = itemArray[1].replace(/[\[\]]/g, '').split(',');
71+
}
6972
itemArray[0] = itemArray[0].replace(this.filterKey, '')
7073
.replace(/[\[\]]/g, '');
7174

dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/url-filter-applier.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ define([
4545
'qty': '1'
4646
});
4747
});
48+
it('return object from url with multiple filters parameter and filter value as array', function () {
49+
var urlSearch = '?filters[name]=[27,23]&filters[qty]=1&anotherparam=1';
50+
51+
expect(urlFilterApplierObj.getFilterParam(urlSearch)).toEqual({
52+
'name': ['27', '23'],
53+
'qty': '1'
54+
});
55+
});
4856
it('return object from url with another parameter', function () {
4957
var urlSearch = '?anotherparam=1';
5058

0 commit comments

Comments
 (0)