forked from extern/egroupware
Use grid's deleteRow() in combination with setTotalCount().
Fixes deleted row remaining, breaking grid after update(), (first row remains after changing filter)
This commit is contained in:
parent
929a29f1fb
commit
b7c989adf8
@ -473,10 +473,6 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput],
|
|||||||
for(var i = 0; i < _row_ids.length; i++)
|
for(var i = 0; i < _row_ids.length; i++)
|
||||||
{
|
{
|
||||||
uid = (this.controller.dataStorePrefix || app) + "::" + _row_ids[i];
|
uid = (this.controller.dataStorePrefix || app) + "::" + _row_ids[i];
|
||||||
entry = this.controller._selectionMgr._getRegisteredRowsEntry(uid);
|
|
||||||
|
|
||||||
// Unselect
|
|
||||||
this.controller._selectionMgr.setSelected(uid,false);
|
|
||||||
|
|
||||||
// Delete from internal references
|
// Delete from internal references
|
||||||
this.controller.deleteRow(uid);
|
this.controller.deleteRow(uid);
|
||||||
@ -489,10 +485,11 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput],
|
|||||||
this.controller._selectionMgr.setFocused(next.id,true);
|
this.controller._selectionMgr.setFocused(next.id,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the count, but don't use setTotalCount() since that will
|
// Update the count
|
||||||
// remove more rows (from the end).
|
|
||||||
var total = this.dataview.grid._total - _row_ids.length;
|
var total = this.dataview.grid._total - _row_ids.length;
|
||||||
this.dataview.grid._total = total;
|
// This will remove the last row!
|
||||||
|
// That's OK, because grid adds one in this.controller.deleteRow()
|
||||||
|
this.dataview.grid.setTotalCount(total);
|
||||||
// Re-enable automatic updating
|
// Re-enable automatic updating
|
||||||
this.dataview.grid.doInvalidate = true;
|
this.dataview.grid.doInvalidate = true;
|
||||||
this.dataview.grid.invalidate();
|
this.dataview.grid.invalidate();
|
||||||
|
@ -135,8 +135,16 @@ var et2_nextmatch_controller = et2_dataview_controller.extend(et2_IDataProvider,
|
|||||||
*/
|
*/
|
||||||
deleteRow: function(uid) {
|
deleteRow: function(uid) {
|
||||||
var entry = this._selectionMgr._getRegisteredRowsEntry(uid);
|
var entry = this._selectionMgr._getRegisteredRowsEntry(uid);
|
||||||
|
|
||||||
|
// Unselect
|
||||||
|
this._selectionMgr.setSelected(uid,false);
|
||||||
|
|
||||||
if(entry && entry.idx !== null)
|
if(entry && entry.idx !== null)
|
||||||
{
|
{
|
||||||
|
// This will remove the row, but add an empty to the end.
|
||||||
|
// That's OK, because it will be removed when we update the row count
|
||||||
|
this._grid.deleteRow(entry.idx);
|
||||||
|
|
||||||
// Trigger controller to remove from internals
|
// Trigger controller to remove from internals
|
||||||
this.egw.dataStoreUID(uid,null);
|
this.egw.dataStoreUID(uid,null);
|
||||||
// Stop caring about this ID
|
// Stop caring about this ID
|
||||||
@ -162,7 +170,8 @@ var et2_nextmatch_controller = et2_dataview_controller.extend(et2_IDataProvider,
|
|||||||
// Remove last one, it was moved to mapIndex-1 before increment
|
// Remove last one, it was moved to mapIndex-1 before increment
|
||||||
delete this._indexMap[mapIndex-1];
|
delete this._indexMap[mapIndex-1];
|
||||||
|
|
||||||
this._selectionMgr.setIndexMap(this._indexMap);
|
// Not needed, they share by reference
|
||||||
|
// this._selectionMgr.setIndexMap(this._indexMap);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user