diff --git a/api/js/etemplate/et2_dataview_controller.js b/api/js/etemplate/et2_dataview_controller.js index a02cf66051..ba60ae4d67 100644 --- a/api/js/etemplate/et2_dataview_controller.js +++ b/api/js/etemplate/et2_dataview_controller.js @@ -88,6 +88,18 @@ var et2_dataview_controller = /** @class */ (function () { } } }; + /** + * Enable or disable autorefresh + * + * disable_autorefresh is used to detect that we have active push in order to enable a fix for push + * on _insertDataRow function reindexing the _indexMap which is wrong for the full refresh. + * + * @param disabled + * @todo remove it after finding a right fix + */ + et2_dataview_controller.prototype.set_disable_autorefresh = function (disabled) { + this._disable_autorefresh = disabled; + }; /** * @param value is an object implementing the et2_IDataProvider * interface @@ -331,8 +343,9 @@ var et2_dataview_controller = /** @class */ (function () { if (createdRow && _entry.row) { this._grid.insertRow(_entry.idx, _entry.row); } - // Update index map - if (this._indexMap[_entry.idx].uid !== _entry.uid) { + //@todo remove it after finding a right fix + // Update index map only for push (autorefresh disabled) + if (this._disable_autorefresh && this._indexMap[_entry.idx].uid !== _entry.uid) { var max = parseInt(Object.keys(this._indexMap).reduce(function (a, b) { return _this._indexMap[a] > _this._indexMap[b] ? a : b; })); for (var idx = max; idx >= _entry.idx; idx--) { this._indexMap[idx].idx = idx + 1; diff --git a/api/js/etemplate/et2_dataview_controller.ts b/api/js/etemplate/et2_dataview_controller.ts index 6c3a2711b8..60bf27d777 100644 --- a/api/js/etemplate/et2_dataview_controller.ts +++ b/api/js/etemplate/et2_dataview_controller.ts @@ -61,6 +61,9 @@ export class et2_dataview_controller private _objectManager: any; + // @todo remove it after finding a right fix + private _disable_autorefresh: boolean; + /** * Constructor of the et2_dataview_controller, connects to the grid * callback. @@ -132,6 +135,20 @@ export class et2_dataview_controller } } + /** + * Enable or disable autorefresh + * + * disable_autorefresh is used to detect that we have active push in order to enable a fix for push + * on _insertDataRow function reindexing the _indexMap which is wrong for the full refresh. + * + * @param disabled + * @todo remove it after finding a right fix + */ + set_disable_autorefresh( disabled : boolean) + { + this._disable_autorefresh = disabled; + } + /** * @param value is an object implementing the et2_IDataProvider * interface @@ -458,8 +475,9 @@ export class et2_dataview_controller this._grid.insertRow(_entry.idx, _entry.row); } - // Update index map - if(this._indexMap[_entry.idx].uid !== _entry.uid) + //@todo remove it after finding a right fix + // Update index map only for push (autorefresh disabled) + if(this._disable_autorefresh && this._indexMap[_entry.idx].uid !== _entry.uid) { let max = parseInt(Object.keys(this._indexMap).reduce((a, b) => this._indexMap[a] > this._indexMap[b] ? a : b)); for(let idx = max; idx >= _entry.idx; idx--) diff --git a/api/js/etemplate/et2_extension_nextmatch.js b/api/js/etemplate/et2_extension_nextmatch.js index 55037195db..cdf89e6915 100644 --- a/api/js/etemplate/et2_extension_nextmatch.js +++ b/api/js/etemplate/et2_extension_nextmatch.js @@ -1238,7 +1238,7 @@ var et2_nextmatch = /** @class */ (function (_super) { autoRefresh_1.set_id("nm_autorefresh"); autoRefresh_1.set_select_options({ // Cause [unknown] problems with mail - //30: "30 seconds", + 3: "30 seconds", //60: "1 Minute", 180: "3 Minutes", 300: "5 Minutes", @@ -1539,6 +1539,8 @@ var et2_nextmatch = /** @class */ (function (_super) { */ et2_nextmatch.prototype.set_disable_autorefresh = function (disabled) { this.options.disable_autorefresh = disabled; + //@todo remove it after finding a right fix + this.controller.set_disable_autorefresh(disabled); this._set_autorefresh(this._get_autorefresh()); }; /** diff --git a/api/js/etemplate/et2_extension_nextmatch.ts b/api/js/etemplate/et2_extension_nextmatch.ts index 292e6837bf..1ca91eb610 100644 --- a/api/js/etemplate/et2_extension_nextmatch.ts +++ b/api/js/etemplate/et2_extension_nextmatch.ts @@ -1738,7 +1738,7 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2 autoRefresh.set_id("nm_autorefresh"); autoRefresh.set_select_options({ // Cause [unknown] problems with mail - //30: "30 seconds", + 3: "30 seconds", //60: "1 Minute", 180: "3 Minutes", 300: "5 Minutes", @@ -2105,6 +2105,8 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2 set_disable_autorefresh( disabled : boolean) { this.options.disable_autorefresh = disabled; + //@todo remove it after finding a right fix + this.controller.set_disable_autorefresh(disabled); this._set_autorefresh(this._get_autorefresh()); }