Fix rows staying after deleting by preventing automatic grid stuff while deleting

This commit is contained in:
Nathan Gray 2014-01-22 15:22:29 +00:00
parent 828acc3b37
commit b4ad250438
3 changed files with 16 additions and 15 deletions

View File

@ -753,11 +753,14 @@ var et2_dataview_controller = Class.extend({
// Delete as many rows as we have left, invalidate the corresponding
// index entry
for (var i = mapIdx; i < _idxMap.length; i++)
for (var i = mapIdx; i < this._grid._map.length; i++)
{
this._grid.deleteRow(i);
if(typeof _idxMap[i] != 'undefined')
{
this._grid.deleteRow(idx);
_idxMap[i].uid = null;
}
}
return result;
},

View File

@ -834,6 +834,8 @@ var et2_dataview_grid = et2_dataview_container.extend(et2_dataview_IViewRange,
* containers have to be removed and where new containers should be added.
*/
_doInvalidate: function(_super) {
if(!this.doInvalidate) return;
// Update the pixel positions
this._recalculateElementPosition();

View File

@ -466,21 +466,17 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput],
{
this.controller._selectionMgr._handleSelect(next.id);
}
// Stop automatic updating
this.dataview.grid.doInvalidate = false;
// Blank the row
this.egw().dataStoreUID(uid,null);
this.dataview.grid.deleteRow(entry.idx);
// Stop caring about this ID
this.egw().dataUnregisterUID(uid);
this.egw().dataDeleteUID(uid);
// Update the count
this.options.settings.total -= 1;
// This removes the last row (in addition), doesn't matter if that wasn't the right one,
// then triggers an invalidate, which may update the grid
// this.dataview.grid.setTotalCount(this.options.settings.total);
// Update directly instead
this.dataview.grid._total = this.options.settings.total;
this.controller._selectionMgr._total = this.options.settings.total;
this.header.count_total.text(this.options.settings.total+"");
var total = this.dataview.grid._total - 1;
this.dataview.grid.setTotalCount(total);
// Re-enable automatic updating
this.dataview.grid.doInvalidate = true;
break;
case "edit":
case "add":