mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-09 15:00:07 +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.egw().dataRegisterUID(uid, callback_1, this, this.getInstanceManager().etemplate_exec_id, this.id);
|
||||||
this.controller._insertDataRow(entry, true);
|
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;
|
return true;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
@ -605,6 +607,8 @@ var et2_nextmatch = /** @class */ (function (_super) {
|
|||||||
if (index === false) {
|
if (index === false) {
|
||||||
return 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
|
// Insert at the top of the list, or where app said
|
||||||
var entry = this.controller._selectionMgr._getRegisteredRowsEntry(uid);
|
var entry = this.controller._selectionMgr._getRegisteredRowsEntry(uid);
|
||||||
entry.idx = typeof index == "number" ? index : 0;
|
entry.idx = typeof index == "number" ? index : 0;
|
||||||
@ -613,12 +617,16 @@ var et2_nextmatch = /** @class */ (function (_super) {
|
|||||||
entry.row.tr.addClass("new_entry");
|
entry.row.tr.addClass("new_entry");
|
||||||
var callback = function (data) {
|
var callback = function (data) {
|
||||||
if (data) {
|
if (data) {
|
||||||
// Increase displayed row count
|
|
||||||
this.controller._grid.setTotalCount(this.controller._grid.getTotalCount() + 1);
|
|
||||||
if (data.class) {
|
if (data.class) {
|
||||||
data.class += " new_entry";
|
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().dataUnregisterUID(uid, callback, this);
|
||||||
};
|
};
|
||||||
this.egw().dataRegisterUID(uid, callback, this, this.getInstanceManager().etemplate_exec_id, this.id);
|
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.egw().dataRegisterUID(uid, callback, this, this.getInstanceManager().etemplate_exec_id, this.id);
|
||||||
this.controller._insertDataRow(entry,true);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
@ -907,6 +909,8 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
|
|||||||
return 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
|
// Insert at the top of the list, or where app said
|
||||||
var entry = this.controller._selectionMgr._getRegisteredRowsEntry(uid);
|
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) {
|
let callback = function(data) {
|
||||||
if(data)
|
if(data)
|
||||||
{
|
{
|
||||||
// Increase displayed row count
|
|
||||||
this.controller._grid.setTotalCount(this.controller._grid.getTotalCount()+1);
|
|
||||||
if(data.class)
|
if(data.class)
|
||||||
{
|
{
|
||||||
data.class += " new_entry";
|
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().dataUnregisterUID(uid, callback, this);
|
||||||
};
|
};
|
||||||
this.egw().dataRegisterUID(uid, callback, this, this.getInstanceManager().etemplate_exec_id, this.id);
|
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) {
|
} catch (e) {
|
||||||
// Remove this callback from the list
|
// 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