Etemplate: nm.refresh() with type 'edit' no longer always fully reloads all rows, it now behaves the same as 'update'

This commit is contained in:
nathangray 2020-07-27 14:07:15 -06:00
parent 77a413b66b
commit 59cd2dcded
2 changed files with 14 additions and 6 deletions

View File

@ -433,14 +433,18 @@ var et2_nextmatch = /** @class */ (function (_super) {
* Change type parameters allows for quicker refresh then complete server side reload:
* - update: request just modified data from given rows. Sorting is not considered,
* so if the sort field is changed, the row will not be moved.
* - edit: rows changed, but sorting may be affected. Requires full reload.
* - edit: rows changed, but sorting may be affected. May require full reload.
* - delete: just delete the given rows clientside (no server interaction neccessary)
* - add: requires full reload
* - add: put the new row in at the top, unless app says otherwise
*
* Nextmatch checks the application callback nm_refresh_index, which has a default implementation
* in egw_app.nm_refresh_index().
*
* @param {string[]|string} _row_ids rows to refresh
* @param {?string} _type "update", "edit", "delete" or "add"
*
* @see jsapi.egw_refresh()
* @see egw_app.nm_refresh_index()
* @fires refresh from the widget itself
*/
et2_nextmatch.prototype.refresh = function (_row_ids, _type) {
@ -500,6 +504,7 @@ var et2_nextmatch = /** @class */ (function (_super) {
id_loop: for (var i = 0; i < _row_ids.length; i++) {
var uid = _row_ids[i].toString().indexOf(this.controller.dataStorePrefix) == 0 ? _row_ids[i] : this.controller.dataStorePrefix + "::" + _row_ids[i];
switch (_type) {
case "edit":
case "update":
if (!this.refresh_update(uid)) {
// Could not update just the row, full refresh has been requested
@ -513,7 +518,6 @@ var et2_nextmatch = /** @class */ (function (_super) {
if (this.refresh_add(uid))
break;
// fall-through / full refresh, if refresh_add returns false
case "edit":
default:
// Trigger refresh
this.applyFilters();

View File

@ -681,14 +681,18 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
* Change type parameters allows for quicker refresh then complete server side reload:
* - update: request just modified data from given rows. Sorting is not considered,
* so if the sort field is changed, the row will not be moved.
* - edit: rows changed, but sorting may be affected. Requires full reload.
* - edit: rows changed, but sorting may be affected. May require full reload.
* - delete: just delete the given rows clientside (no server interaction neccessary)
* - add: requires full reload
* - add: put the new row in at the top, unless app says otherwise
*
* Nextmatch checks the application callback nm_refresh_index, which has a default implementation
* in egw_app.nm_refresh_index().
*
* @param {string[]|string} _row_ids rows to refresh
* @param {?string} _type "update", "edit", "delete" or "add"
*
* @see jsapi.egw_refresh()
* @see egw_app.nm_refresh_index()
* @fires refresh from the widget itself
*/
refresh( _row_ids, _type)
@ -765,6 +769,7 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
var uid = _row_ids[i].toString().indexOf(this.controller.dataStorePrefix) == 0 ? _row_ids[i] : this.controller.dataStorePrefix + "::" + _row_ids[i];
switch(_type)
{
case "edit":
case "update":
if(!this.refresh_update(uid))
{
@ -778,7 +783,6 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
case "add":
if (this.refresh_add(uid)) break;
// fall-through / full refresh, if refresh_add returns false
case "edit":
default:
// Trigger refresh
this.applyFilters();