Skip to content

Commit

Permalink
introduce new option selectAllMode, change default behavior of select…
Browse files Browse the repository at this point in the history
…All button for multiPageSelection mode

New option `selectAllMode` can have `"filtered"` or `"all"` values. `"all"` means old behavior where all local data will be selected. The default value of `selectAllMode` is `"filtered"`, which means that only the last filtered data (not only from the current page) will be selected.
  • Loading branch information
OlegKi committed Feb 24, 2018
1 parent 54b122b commit 6ac1b3d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 10 additions & 2 deletions js/grid.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -2877,6 +2877,7 @@
deselectAfterSort: true,
resetPageAfterSort: true,
multiPageSelection: false,
selectAllMode: "filtered",
scrollrows: false,
autowidth: false,
scrollOffset: 18,
Expand Down Expand Up @@ -5503,13 +5504,20 @@
},
frozenRows = grid.fbRows,
skipClasses = disabledStateClasses + " ui-subgrid jqgroup jqfoot jqgfirstrow jqgskipselect",
id, ids = p._index;
id, ids = p._index, iSel;
clearArray(p.selarrrow); // p.selarrrow = [];
if (this.checked) {
toCheck = true;
p.selrow = ts.rows.length > 1 ? ts.rows[ts.rows.length - 1].id : null;
if (p.multiPageSelection && (p.datatype === "local" || p.treeGrid)) {
if (p.data != null && p.data.length > 0 && ids != null) {
if (p.selectAllMode === "filtered" && p.lastSelectedData != null && p.lastSelectedData.length > 0) {
p.selarrrow = [];
for (iSel = 0; iSel < p.lastSelectedData.length; iSel++) {
if (p.lastSelectedData[iSel].hasOwnProperty(p.localReader.id)) {
p.selarrrow.push(p.idPrefix + p.lastSelectedData[iSel][p.localReader.id]);
}
}
} else if (p.data != null && p.data.length > 0 && ids != null) {
// add to selarrrow all
for (id in ids) {
if (ids.hasOwnProperty(id)) {
Expand Down
1 change: 1 addition & 0 deletions ts/free-jqgrid.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,7 @@ declare namespace FreeJqGrid {
multiboxonly?: boolean;
multikey?: boolean;
multiPageSelection?: boolean;
selectAllMode?: "filtered" | "all"; // "filtered"
multiselect?: boolean;
multiselectPosition?: "left" | "right" | "none";
multiselectWidth?: number; // 16
Expand Down

0 comments on commit 6ac1b3d

Please sign in to comment.