mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 07:53:39 +01:00
Etemplate: More fixes for row count when updating / adding
Now fixed the situation where 1 row was updated & 1 added, but the added one did not match filter and was not returned when server was asked. Now removed blank row waiting for it, and keeping row count consistent
This commit is contained in:
parent
953a132e9c
commit
210c54b689
@ -589,6 +589,8 @@ var et2_nextmatch = /** @class */ (function (_super) {
|
||||
this.egw().dataRegisterUID(uid, callback_1, this, this.getInstanceManager().etemplate_exec_id, this.id);
|
||||
this.controller._insertDataRow(entry, true);
|
||||
}
|
||||
// Update does not need to increase row count, but refresh_add() adds it in
|
||||
this.controller._grid.setTotalCount(this.controller._grid.getTotalCount() - 1);
|
||||
return true;
|
||||
};
|
||||
/**
|
||||
@ -605,6 +607,8 @@ var et2_nextmatch = /** @class */ (function (_super) {
|
||||
if (index === false) {
|
||||
return false;
|
||||
}
|
||||
// Increase displayed row count or we lose the last row when we add
|
||||
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;
|
||||
@ -613,12 +617,16 @@ var et2_nextmatch = /** @class */ (function (_super) {
|
||||
entry.row.tr.addClass("new_entry");
|
||||
var callback = function (data) {
|
||||
if (data) {
|
||||
// Increase displayed row count
|
||||
this.controller._grid.setTotalCount(this.controller._grid.getTotalCount() + 1);
|
||||
if (data.class) {
|
||||
data.class += " new_entry";
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Server didn't give us our row data
|
||||
// Delete from internal references
|
||||
this.controller.deleteRow(uid);
|
||||
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);
|
||||
|
@ -886,6 +886,8 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
|
||||
this.egw().dataRegisterUID(uid, callback, this, this.getInstanceManager().etemplate_exec_id, this.id);
|
||||
this.controller._insertDataRow(entry,true);
|
||||
}
|
||||
// Update does not need to increase row count, but refresh_add() adds it in
|
||||
this.controller._grid.setTotalCount(this.controller._grid.getTotalCount()-1);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -907,6 +909,8 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
|
||||
return false;
|
||||
}
|
||||
|
||||
// Increase displayed row count or we lose the last row when we add
|
||||
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,13 +922,18 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
|
||||
let callback = function(data) {
|
||||
if(data)
|
||||
{
|
||||
// Increase displayed row count
|
||||
this.controller._grid.setTotalCount(this.controller._grid.getTotalCount()+1);
|
||||
if(data.class)
|
||||
{
|
||||
data.class += " new_entry";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Server didn't give us our row data
|
||||
// Delete from internal references
|
||||
this.controller.deleteRow(uid);
|
||||
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);
|
||||
|
@ -806,7 +806,10 @@ egw.extend("data_storage", egw.MODULE_GLOBAL, function (_app, _wnd) {
|
||||
);
|
||||
} catch (e) {
|
||||
// Remove this callback from the list
|
||||
registeredCallbacks[_uid].splice(i, 1);
|
||||
if(typeof registeredCallbacks[_uid] != "undefined")
|
||||
{
|
||||
registeredCallbacks[_uid].splice(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user