mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-30 14:40:34 +02:00
Etemplate: Update controller indexMap when adding a new row
Fixes deleting former top mail that got moved down by a pushed new mail removed both newly added and the selected mail
This commit is contained in:
@ -458,6 +458,18 @@ export class et2_dataview_controller
|
||||
this._grid.insertRow(_entry.idx, _entry.row);
|
||||
}
|
||||
|
||||
// Update index map
|
||||
if(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--)
|
||||
{
|
||||
this._indexMap[idx].idx = idx+1;
|
||||
this._indexMap[this._indexMap[idx].idx] = this._indexMap[idx];
|
||||
}
|
||||
this._indexMap[_entry.idx] = _entry
|
||||
}
|
||||
|
||||
return this.hasData;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user