Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "handsontable-key-value",
"version": "3.0.2",
"version": "3.0.3",
"description": "Handstontable plugin to handle key-value pair data type.",
"repository": {
"type": "git",
Expand Down Expand Up @@ -35,7 +35,7 @@
"rimraf": "^2.6.3"
},
"peerDependencies": {
"handsontable": "^7.0.0"
"handsontable": ">=7.0.0"
},
"dependencies": {
"lodash.deburr": "^4.1.0"
Expand Down
22 changes: 20 additions & 2 deletions src/filters/keyValueMultipleSelectUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,26 @@ class KeyValueMultipleSelect extends MultipleSelectUI {
return;
}

// Don't know why in the official version we compute again the checked values,
// as it's already done by ValueComponent. So, just load the items.
// If the filter has been set programmatically, we need to retrive which item(s) should be checked
const lastSelectedColumn = this.hot.getPlugin('filtersKeyValue').getSelectedColumn();
if (this.items.length) {
const { conditions } = this.hot.getPlugin('filtersKeyValue').conditionCollection;
if (conditions.conjunction) {
const toCheck = conditions.conjunction[lastSelectedColumn.visualIndex];
if (toCheck) {
toCheck.forEach((filter) => {
if (filter.name === 'by_value') {
this.items.forEach((item) => {
item.checked = filter.args.flat().includes(item.value);
});
}
/** @todo Handle other cases than 'by_value' ? */
});
}
}
/** @todo Is it needed for disjuntion case ? */
}
// else it's already done by ValueComponent. So, just load the items.
this.itemsBox.loadData(this.items);
}

Expand Down