From 41ddc8ad52958f6a240afa74d5daaca3271d8f26 Mon Sep 17 00:00:00 2001
From: Renaud Le Gac <legac@cppm.in2p3.fr>
Date: Fri, 6 Dec 2013 15:01:18 +0100
Subject: [PATCH] ExtJS 4.2: Modify the reset mechanism for grid (to be
 imporved).

---
 static/plugin_dbui/src/grid.js | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/static/plugin_dbui/src/grid.js b/static/plugin_dbui/src/grid.js
index a7edcd41..2f473262 100644
--- a/static/plugin_dbui/src/grid.js
+++ b/static/plugin_dbui/src/grid.js
@@ -65,8 +65,9 @@ Ext.define('App.grid.Grid', {
     },
 
     /**
-     * Reset the grid.
-     * The store is load with fresh data and the event *resetgrid* is fired.
+     * Reset the grid by removing filtering conditions
+     * and by loading fresh data when the store is buffered.
+     * TODO: duplicate with gridfilter.onReset. Improve it.
      *
      */
     reset: function () {
@@ -75,13 +76,17 @@ Ext.define('App.grid.Grid', {
 
         var store = this.getStore();
 
-        store.restoreWhere();
+        if (store.buffered) {
 
-        if (this.getStore().buffered) {
+            store.restoreWhere();
+            store.data.clear(true);
             store.loadPage(1);
 
         } else {
-            store.load();
+
+            store.clearFilter();
+            store.filter();
         }
+
     }
 });
-- 
GitLab