Etemplate: Fix drag and drop linking made the rows involved disappear

This commit is contained in:
nathangray 2020-10-14 10:37:47 -06:00
parent aec60b5c19
commit 27fd45c9ab
2 changed files with 21 additions and 2 deletions

View File

@ -500,6 +500,15 @@ var et2_nextmatch = /** @class */ (function (_super) {
jQuery(this).triggerHandler("refresh", [this]); jQuery(this).triggerHandler("refresh", [this]);
return; return;
} }
// Clean IDs in case they're UIDs with app prefixed
_row_ids = _row_ids.map(function (id) {
if (id.toString().indexOf(this.controller.dataStorePrefix) == -1) {
return id;
}
var parts = id.split("::");
parts.shift();
return parts.join("::");
}.bind(this));
if (_type == et2_nextmatch.DELETE) { if (_type == et2_nextmatch.DELETE) {
// Record current & next index // Record current & next index
var uid = _row_ids[0].toString().indexOf(this.controller.dataStorePrefix) == 0 ? _row_ids[0] : this.controller.dataStorePrefix + "::" + _row_ids[0]; var uid = _row_ids[0].toString().indexOf(this.controller.dataStorePrefix) == 0 ? _row_ids[0] : this.controller.dataStorePrefix + "::" + _row_ids[0];
@ -560,7 +569,7 @@ var et2_nextmatch = /** @class */ (function (_super) {
this.nm.controller.deleteRow(this.uid); this.nm.controller.deleteRow(this.uid);
// Adjust total rows, clean grid // Adjust total rows, clean grid
this.nm.controller._grid.setTotalCount(this.nm.controller._grid._total - _row_ids.length); this.nm.controller._grid.setTotalCount(this.nm.controller._grid._total - _row_ids.length);
this.controller._selectionMgr.setTotalCount(this.nm.controller._grid._total); this.nm.controller._selectionMgr.setTotalCount(this.nm.controller._grid._total);
} }
}, { type: _type, nm: this_1, uid: uid_1, prefix: this_1.controller.dataStorePrefix }, [_row_ids]); }, { type: _type, nm: this_1, uid: uid_1, prefix: this_1.controller.dataStorePrefix }, [_row_ids]);
return { value: void 0 }; return { value: void 0 };

View File

@ -777,6 +777,16 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
return; return;
} }
// Clean IDs in case they're UIDs with app prefixed
_row_ids = _row_ids.map( function(id) {
if( id.toString().indexOf(this.controller.dataStorePrefix) == -1)
{
return id;
}
let parts = id.split("::");
parts.shift();
return parts.join("::");
}.bind(this));
if(_type == et2_nextmatch.DELETE) if(_type == et2_nextmatch.DELETE)
{ {
// Record current & next index // Record current & next index
@ -862,7 +872,7 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
// Adjust total rows, clean grid // Adjust total rows, clean grid
this.nm.controller._grid.setTotalCount(this.nm.controller._grid._total- _row_ids.length); this.nm.controller._grid.setTotalCount(this.nm.controller._grid._total- _row_ids.length);
this.controller._selectionMgr.setTotalCount(this.nm.controller._grid._total); this.nm.controller._selectionMgr.setTotalCount(this.nm.controller._grid._total);
} }
}, {type: _type, nm: this, uid: uid, prefix: this.controller.dataStorePrefix}, [_row_ids] }, {type: _type, nm: this, uid: uid, prefix: this.controller.dataStorePrefix}, [_row_ids]
); );