changeset 810:a5373ee662e2

Created a loading Animation for the Filterresultgrid
author Dustin Demuth <dustin@intevation.de>
date Wed, 27 May 2015 16:01:59 +0200
parents 3bc19188fc3a
children 5cdfe0ff1df3
files app/controller/Filter.js app/controller/FilterResult.js
diffstat 2 files changed, 37 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/Filter.js	Fri May 22 16:14:14 2015 +0200
+++ b/app/controller/Filter.js	Wed May 27 16:01:59 2015 +0200
@@ -219,6 +219,8 @@
             store = Ext.create(sname);
         }
         if (store) {
+            store.addListener('beforeload', this.loadingAnimationOn, resultGrid);
+            store.addListener('load', this.loadingAnimationOff, resultGrid);
             resultGrid.setStore(store);
             resultGrid.setupColumns(this.displayFields);
             resultGrid.getStore().proxy.extraParams = searchParams;
@@ -226,6 +228,23 @@
             resultGrid.show();
         }
     },
+
+    /**
+     * Enable the Loading Animation of the Grid.
+     */
+    loadingAnimationOn: function(store, operation) {
+        // this = resultgrid because of the scope which was set in addListener
+        this.setLoading(true);
+    },
+
+    /**
+     * Disable the Loading Animation of the Grid.
+     */
+    loadingAnimationOff: function(store, operation) {
+        // this = resultgrid because of the scope which was set in addListener
+        this.setLoading(false);
+    },
+
     /**
      * This function resets the filters
      */
--- a/app/controller/FilterResult.js	Fri May 22 16:14:14 2015 +0200
+++ b/app/controller/FilterResult.js	Wed May 27 16:01:59 2015 +0200
@@ -17,13 +17,17 @@
     ],
 
     /**
-     * Initialize the Controller with 4 listeners
+     * Initialize the Controller with listeners
      */
     init: function() {
         this.control({
             'filterresultgrid': {
                 itemdblclick: this.editItem
             },
+            'store': {
+                beforeload: this.loadingAnimationOn,
+                load:   this.loadingAnimationOff
+            },
             'filterresultgrid toolbar button[action=addProbe]': {
                 click: this.addProbeItem
             },
@@ -39,6 +43,19 @@
         });
         this.callParent(arguments);
     },
+    /**
+     * Enable the Loading Animation of the Grid.
+     */
+     loadingAnimationOn: function(store, operation) {
+        store.up('grid').setLoading(true);
+     },
+
+    /**
+     * Disable the Loading Animation of the Grid.
+     */
+     loadingAnimationOff: function(store, operation) {
+        store.up('grid').setLoading(false);
+     },
 
     /**
      * This function is called after a Row in the

http://lada.wald.intevation.org