From 27fd45c9abec7fe64d51a53f4cb955be7bd3f189 Mon Sep 17 00:00:00 2001 From: nathangray Date: Wed, 14 Oct 2020 10:37:47 -0600 Subject: [PATCH] Etemplate: Fix drag and drop linking made the rows involved disappear --- api/js/etemplate/et2_extension_nextmatch.js | 11 ++++++++++- api/js/etemplate/et2_extension_nextmatch.ts | 12 +++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/api/js/etemplate/et2_extension_nextmatch.js b/api/js/etemplate/et2_extension_nextmatch.js index 3fb3cd3c44..58e3f1753f 100644 --- a/api/js/etemplate/et2_extension_nextmatch.js +++ b/api/js/etemplate/et2_extension_nextmatch.js @@ -500,6 +500,15 @@ var et2_nextmatch = /** @class */ (function (_super) { jQuery(this).triggerHandler("refresh", [this]); 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) { // Record current & next index 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); // Adjust total rows, clean grid 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]); return { value: void 0 }; diff --git a/api/js/etemplate/et2_extension_nextmatch.ts b/api/js/etemplate/et2_extension_nextmatch.ts index b9409bd94c..05a470d742 100644 --- a/api/js/etemplate/et2_extension_nextmatch.ts +++ b/api/js/etemplate/et2_extension_nextmatch.ts @@ -777,6 +777,16 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2 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) { // Record current & next index @@ -862,7 +872,7 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2 // Adjust total rows, clean grid 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] );