Skip to content

Commit

Permalink
grid reload mit selectIds
Browse files Browse the repository at this point in the history
  • Loading branch information
inlandschweizer committed Nov 14, 2023
1 parent 3925ff9 commit 4fd95bb
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions js/gui/grid/kijs.gui.grid.Grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,17 +416,18 @@ kijs.gui.grid.Grid = class kijs_gui_grid_Grid extends kijs.gui.Element {
* Als Workaround laden wir bei resetData = false alle im Grid vorhandenen Rows neu. Siehe this._remoteLoad():
*
* Lädt die Daten im Grid neu.
* @param {Boolean} restoreSelection
* @param {Boolean} resetData Vollständig & von Anfang an neu laden (z.B. beim Filtern, Sortieren)
* @returns {Promise}
*
* resetData: Vollständig & von Anfang an neu laden (z.B. beim Filtern, Sortieren)
*/
reload(restoreSelection = true, resetData = true) {
let selected = this.getSelectedIds();
return this._remoteLoad(resetData).then((response) => {
reload(restoreSelection = true, resetData = true, selectIds = []) {
if (!selectIds) {
selectIds = this.getSelectedIds();
}
return this._remoteLoad(resetData, false, selectIds).then((response) => {

// Selektion wiederherstellen
if (selected && restoreSelection) {
this.selectByIds(selected, false, true);
if (selectIds && restoreSelection) {
this.selectByIds(selectIds, false);
}

if (
Expand Down Expand Up @@ -912,7 +913,7 @@ kijs.gui.grid.Grid = class kijs_gui_grid_Grid extends kijs.gui.Element {
return rowMatch;
}

_remoteLoad(resetData=false, loadNextData=false) {
_remoteLoad(resetData= false, loadNextData= false, selectIds = []) {
return new Promise((resolve) => {
if (
this._facadeFnLoad
Expand All @@ -929,6 +930,7 @@ kijs.gui.grid.Grid = class kijs_gui_grid_Grid extends kijs.gui.Element {

let args = {};
args.sort = this._remoteSort;
args.selectIds = selectIds;
args.getMetaData = this._getRemoteMetaData;
args.filter = this._filter.getFilters();

Expand Down Expand Up @@ -959,12 +961,10 @@ kijs.gui.grid.Grid = class kijs_gui_grid_Grid extends kijs.gui.Element {
let showWaitMask = this._remoteDataStartIndex === 0;

// RPC ausführen
this._rpc.do(this._facadeFnLoad, args, function(response) {
this._rpc.do(
this._facadeFnLoad, args, function(response) {
this._remoteProcess(response, args, resetData);

// Promise auflösen
resolve(response);

},
this, // Context
true, // Cancel running
Expand Down

0 comments on commit 4fd95bb

Please sign in to comment.