[Lada-commits] [PATCH] Created a loading Animation for the Filterresultgrid

Wald Commits scm-commit at wald.intevation.org
Wed May 27 16:02:14 CEST 2015


# HG changeset patch
# User Dustin Demuth <dustin at intevation.de>
# Date 1432735319 -7200
# Node ID a5373ee662e2b7030d6c895310f138e89adb0060
# Parent  3bc19188fc3a264684b8fd10128b760a7e6746e5
Created a loading Animation for the Filterresultgrid

diff -r 3bc19188fc3a -r a5373ee662e2 app/controller/Filter.js
--- 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
      */
diff -r 3bc19188fc3a -r a5373ee662e2 app/controller/FilterResult.js
--- 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


More information about the Lada-commits mailing list