Skip to content

Commit

Permalink
Fixed grid multiselect issue magento#24400
Browse files Browse the repository at this point in the history
  • Loading branch information
mahesh-rajawat committed Jan 22, 2020
1 parent 420a8b6 commit bcd0ec9
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion app/code/Magento/Ui/view/base/web/js/grid/columns/multiselect.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,12 @@ define([
* @returns {Multiselect} Chainable.
*/
togglePage: function () {
var total = this.getIds().length,
selected = this.getPageSelections().length;

if (this.isPageSelected() && selected !== total) {
return this.selectPage();
}
return this.isPageSelected() ? this.deselectPage() : this.selectPage();
},

Expand Down Expand Up @@ -438,7 +444,9 @@ define([
excluded = this.excluded().length,
totalSelected = this.totalSelected(),
totalRecords = this.totalRecords(),
allSelected = totalRecords && totalSelected === totalRecords;
allSelected = totalRecords && totalSelected === totalRecords,
pageTotal = this.getIds().length,
pageSelected = this.getPageSelections().length;

if (this.excludeMode()) {
if (excluded === totalRecords && !this.preserveSelectionsOnFilter) {
Expand All @@ -451,6 +459,12 @@ define([
this.allSelected(allSelected);
this.indetermine(totalSelected && !allSelected);

if (pageTotal !== pageSelected) {
this.allSelected(false);
} else if (pageTotal === pageSelected) {
this.allSelected(true);
}

return this;
},

Expand Down Expand Up @@ -486,6 +500,9 @@ define([
newSelections = _.union(this.getIds(true), this.selected());

this.selected(newSelections);
} else {
this.countSelected()
.updateState();
}
},

Expand Down

0 comments on commit bcd0ec9

Please sign in to comment.