From 87473ae76bcfa83e473e5bf1ce74e4ed85bacd25 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Tue, 21 Jan 2014 15:50:06 +0000 Subject: [PATCH] Fix cache clearing in selection manager --- etemplate/js/et2_dataview_controller.js | 6 ++++++ etemplate/js/et2_dataview_controller_selection.js | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/etemplate/js/et2_dataview_controller.js b/etemplate/js/et2_dataview_controller.js index 3489ce136a..44f591eae9 100644 --- a/etemplate/js/et2_dataview_controller.js +++ b/etemplate/js/et2_dataview_controller.js @@ -143,9 +143,15 @@ var et2_dataview_controller = Class.extend({ // Scroll to top this._grid.makeIndexVisible(0); this._grid.clear(); + + // Free selection manager + this._selectionMgr.clear(); // Clear the map this._indexMap = {} + // Update selection manager, it uses this by reference + this._selectionMgr.setIndexMap(this._indexMap); + // Clear the queue this._queue = {}; } diff --git a/etemplate/js/et2_dataview_controller_selection.js b/etemplate/js/et2_dataview_controller_selection.js index a86c78a9a9..276377effb 100644 --- a/etemplate/js/et2_dataview_controller_selection.js +++ b/etemplate/js/et2_dataview_controller_selection.js @@ -94,6 +94,19 @@ var et2_dataview_selectionManager = Class.extend( this.select_callback = null; }, + clear: function() { + for (var key in this._registeredRows) + { + this.unregisterRow(key, this._registeredRows[key].tr); + } + this._indexMap = {}; + this._total = 0; + this._focusedEntry = null; + this._invertSelection = false; + this._selectAll = false; + this._inUpdate = false; + }, + setIndexMap: function (_indexMap) { this._indexMap = _indexMap; },