Etemplate: Fix another bug in refresh / add / update

This one was found in Infolog, adding a sub to an entry with the show-subs preference set to only while filtering.  The row count would be off by one if the new entry did not match the filter.
This commit is contained in:
nathangray 2020-09-01 11:54:16 -06:00
parent eb812dad01
commit df57ea914e
2 changed files with 12 additions and 6 deletions

View File

@ -605,8 +605,6 @@ var et2_nextmatch = /** @class */ (function (_super) {
if (index === false) {
return false;
}
// Increase displayed row count
this.controller._grid.setTotalCount(this.controller._grid.getTotalCount() + 1);
// Insert at the top of the list, or where app said
var entry = this.controller._selectionMgr._getRegisteredRowsEntry(uid);
entry.idx = typeof index == "number" ? index : 0;
@ -614,7 +612,11 @@ var et2_nextmatch = /** @class */ (function (_super) {
// Set "new entry" class - but it has to stay so register and re-add it after the data is there
entry.row.tr.addClass("new_entry");
var callback = function (data) {
data.class += " new_entry";
if (data && data.class) {
data.class += " new_entry";
// Increase displayed row count
this.controller._grid.setTotalCount(this.controller._grid.getTotalCount() + 1);
}
this.egw().dataUnregisterUID(uid, callback, this);
};
this.egw().dataRegisterUID(uid, callback, this, this.getInstanceManager().etemplate_exec_id, this.id);

View File

@ -907,8 +907,6 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
return false;
}
// Increase displayed row count
this.controller._grid.setTotalCount(this.controller._grid.getTotalCount()+1);
// Insert at the top of the list, or where app said
var entry = this.controller._selectionMgr._getRegisteredRowsEntry(uid);
@ -918,7 +916,13 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
// Set "new entry" class - but it has to stay so register and re-add it after the data is there
entry.row.tr.addClass("new_entry");
let callback = function(data) {
data.class += " new_entry";
if(data && data.class)
{
data.class += " new_entry";
// Increase displayed row count
this.controller._grid.setTotalCount(this.controller._grid.getTotalCount()+1);
}
this.egw().dataUnregisterUID(uid, callback, this);
};
this.egw().dataRegisterUID(uid, callback, this, this.getInstanceManager().etemplate_exec_id, this.id);