A temporary fix for commit 471741ce12 which breaks nm row update with auto refresh enabled

This commit is contained in:
Hadi Nategh
2020-08-12 12:04:03 +02:00
parent 6bd87cafb5
commit fe47a2af28
4 changed files with 41 additions and 6 deletions

View File

@ -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--)