From 897a16cd8f52d8b6a3a88d41648d9773a9639a1e Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Tue, 14 Apr 2015 16:40:15 +0000 Subject: [PATCH] Don't keep selection if it is not returned after an update. Fixes IDs stay after entry is changed to not match the current filters. --- etemplate/js/et2_dataview_controller_selection.js | 1 + etemplate/js/et2_extension_nextmatch_controller.js | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/etemplate/js/et2_dataview_controller_selection.js b/etemplate/js/et2_dataview_controller_selection.js index 8669e5f41c..8ad3c6834a 100644 --- a/etemplate/js/et2_dataview_controller_selection.js +++ b/etemplate/js/et2_dataview_controller_selection.js @@ -98,6 +98,7 @@ var et2_dataview_selectionManager = Class.extend( for (var key in this._registeredRows) { this.unregisterRow(key, this._registeredRows[key].tr); + delete this._registeredRows[key]; } this._indexMap = {}; this._total = 0; diff --git a/etemplate/js/et2_extension_nextmatch_controller.js b/etemplate/js/et2_extension_nextmatch_controller.js index 6c8364b8a7..4bb492d1d1 100644 --- a/etemplate/js/et2_extension_nextmatch_controller.js +++ b/etemplate/js/et2_extension_nextmatch_controller.js @@ -567,9 +567,13 @@ var et2_nextmatch_controller = et2_dataview_controller.extend(et2_IDataProvider, } for(var i = 0; i < this.self.kept_selection.ids.length || 0; i++) { - this.self._selectionMgr.setSelected(this.self.kept_selection.ids[i],true); + // Only keep the selected if they came back in the fetch + if(_response.order.indexOf(this.self.kept_selection.ids[i]) >= 0) + { + this.self._selectionMgr.setSelected(this.self.kept_selection.ids[i],true); + } } - if(this.self.kept_focus) + if(this.self.kept_focus && _response.order.indexOf(this.self.kept_focus) >= 0) { this.self._selectionMgr.setFocused(this.self.kept_focus,true); }