From 45bc2123eef68c827a75e8068fc8e270b0bf1c43 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Thu, 16 Apr 2015 15:18:46 +0000 Subject: [PATCH] Don't apply selection if it is not returned after an update, but keep it in case the user needs to scroll first. --- etemplate/js/et2_extension_nextmatch_controller.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/etemplate/js/et2_extension_nextmatch_controller.js b/etemplate/js/et2_extension_nextmatch_controller.js index 4bb492d1d1..dde1fa7694 100644 --- a/etemplate/js/et2_extension_nextmatch_controller.js +++ b/etemplate/js/et2_extension_nextmatch_controller.js @@ -565,12 +565,13 @@ var et2_nextmatch_controller = et2_dataview_controller.extend(et2_IDataProvider, { this.self._selectionMgr.selectAll(); } - for(var i = 0; i < this.self.kept_selection.ids.length || 0; i++) + for(var i = (this.self.kept_selection.ids.length || 1)-1; i >= 0; i--) { // 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); + this.self.kept_selection.ids.splice(i,1); } } if(this.self.kept_focus && _response.order.indexOf(this.self.kept_focus) >= 0) @@ -579,7 +580,10 @@ var et2_nextmatch_controller = et2_dataview_controller.extend(et2_IDataProvider, } // Re-expanding rows handled in et2_extension_nextmatch_rowProvider // Expansions might still be valid, so we don't clear them - this.self.kept_selection = null; + if(this.self.kept_selection != null && this.self.kept_selection.length == 0) + { + this.self.kept_selection = null; + } this.self.kept_focus = null; } },