From 26a6749b3dca0e95f3fd1bd5ff0731e3599033bf Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 17 Aug 2020 12:15:40 +0200 Subject: [PATCH] * All apps: fix last rows was removed when adding new entry to list with only a couple of rows see ticket #48204, we do a full refresh now to work around this issue until we have a real fix --- api/js/etemplate/et2_dataview_controller.js | 6 ++++++ api/js/etemplate/et2_dataview_controller.ts | 11 ++++++++++- api/js/etemplate/et2_extension_nextmatch.js | 5 +++++ api/js/etemplate/et2_extension_nextmatch.ts | 7 +++++++ 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/api/js/etemplate/et2_dataview_controller.js b/api/js/etemplate/et2_dataview_controller.js index ba60ae4d67..380c5d4068 100644 --- a/api/js/etemplate/et2_dataview_controller.js +++ b/api/js/etemplate/et2_dataview_controller.js @@ -277,6 +277,12 @@ var et2_dataview_controller = /** @class */ (function () { } return row; }; + /** + * Returns the current "total" count. + */ + et2_dataview_controller.prototype.getTotalCount = function () { + return this._grid.getTotalCount(); + }; /* -- PRIVATE FUNCTIONS -- */ et2_dataview_controller.prototype._getIndexEntry = function (_idx) { // Create an entry in the index map if it does not exist yet diff --git a/api/js/etemplate/et2_dataview_controller.ts b/api/js/etemplate/et2_dataview_controller.ts index 60bf27d777..65e70155a0 100644 --- a/api/js/etemplate/et2_dataview_controller.ts +++ b/api/js/etemplate/et2_dataview_controller.ts @@ -23,6 +23,7 @@ import {et2_IDataProvider} from "./et2_dataview_interfaces"; import {et2_dataview_selectionManager} from "./et2_dataview_controller_selection"; import {et2_dataview_row} from "./et2_dataview_view_row"; +import {et2_dataview_grid} from "./et2_dataview_view_grid"; /** * The fetch timeout specifies the time during which the controller tries to @@ -43,7 +44,7 @@ export class et2_dataview_controller public static readonly CONCURRENT_REQUESTS = 5; private _parentController: any; - private _grid: any; + private _grid: et2_dataview_grid; private dataStorePrefix: any; private _dataProvider: any; private _rowCallback: any; @@ -390,6 +391,14 @@ export class et2_dataview_controller return row; } + /** + * Returns the current "total" count. + */ + getTotalCount() : number + { + return this._grid.getTotalCount(); + } + /* -- PRIVATE FUNCTIONS -- */ diff --git a/api/js/etemplate/et2_extension_nextmatch.js b/api/js/etemplate/et2_extension_nextmatch.js index a0a6f8bc93..37be55d495 100644 --- a/api/js/etemplate/et2_extension_nextmatch.js +++ b/api/js/etemplate/et2_extension_nextmatch.js @@ -595,6 +595,11 @@ var et2_nextmatch = /** @class */ (function (_super) { if (type === void 0) { type = et2_nextmatch.ADD; } var index = egw.preference("lazy-update") == "lazy" ? 0 : (this.is_sorted_by_modified() ? 0 : false); + // workaround for datagrid deleting the last row, see ticket #48204 + // if we only have a couple of rows, do a full refresh instead + if (this.controller.getTotalCount() < 15) { + return false; + } // No add, do a full refresh if (index === false) { return false; diff --git a/api/js/etemplate/et2_extension_nextmatch.ts b/api/js/etemplate/et2_extension_nextmatch.ts index 2d1b9c5c11..2e675f663d 100644 --- a/api/js/etemplate/et2_extension_nextmatch.ts +++ b/api/js/etemplate/et2_extension_nextmatch.ts @@ -892,6 +892,13 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2 let index : boolean | number = egw.preference("lazy-update") == "lazy" ? 0 : (this.is_sorted_by_modified() ? 0 : false); + // workaround for datagrid deleting the last row, see ticket #48204 + // if we only have a couple of rows, do a full refresh instead + if (this.controller.getTotalCount() < 15) + { + return false; + } + // No add, do a full refresh if(index === false) {