Skip to content

Commit

Permalink
ENGCOM-2711: [Forwardport] Improvements in UI component MassActions #…
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav Idolov authored Aug 10, 2018
2 parents 728f29d + 730e1ea commit acd9947
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,15 @@ define([
return this;
},

/**
* Selects or deselects all records on the current page.
*
* @returns {Multiselect} Chainable.
*/
togglePage: function () {
return this.isPageSelected() ? this.deselectPage() : this.selectPage();
},

/**
* Clears the array of not selected records.
*
Expand Down
7 changes: 5 additions & 2 deletions app/code/Magento/Ui/view/base/web/js/grid/massactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,14 @@ define([
* invoked if action is confirmed.
*/
_confirm: function (action, callback) {
var confirmData = action.confirm;
var confirmData = action.confirm,
data = this.getSelections(),
total = data.total ? data.total : 0,
confirmMessage = confirmData.message + ' (' + total + ' record' + (total > 1 ? 's' : '') + ')';

confirm({
title: confirmData.title,
content: confirmData.message,
content: confirmMessage,
actions: {
confirm: callback
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
data-bind="
checked: allSelected(),
attr: {id: ++ko.uid},
event: { change: toggleSelectAll },
event: { change: togglePage },
css: { '_indeterminate': indetermine },
enable: totalRecords">
<label attr="for: ko.uid"/>
Expand Down

0 comments on commit acd9947

Please sign in to comment.