Make it a little more straightfoward to refresh an autogrid from without. Can
authorsenator <senator@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 10 Sep 2010 22:02:18 +0000 (22:02 +0000)
committersenator <senator@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 10 Sep 2010 22:02:18 +0000 (22:02 +0000)
be useful in making glitchy, half-rendered grids behave.

git-svn-id: svn://svn.open-ils.org/ILS/trunk@17597 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/dojo/openils/widget/AutoGrid.js

index 923c9b4..4495e1c 100644 (file)
@@ -87,14 +87,10 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
                         style : 'padding-right:6px;',
                         href : 'javascript:void(0);', 
                         onclick : function() { 
-                            self.resetStore();
                             self.cachedQueryOpts.offset = self.displayOffset -= self.displayLimit;
                             if(self.displayOffset < 0)
                                 self.cachedQueryOpts.offset = self.displayOffset = 0;
-                            if(self.dataLoader)
-                                self.dataLoader()
-                            else
-                                self.loadAll(self.cachedQueryOpts, self.cachedQuerySearch);
+                            self.refresh();
                         }
                     });
 
@@ -103,12 +99,8 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
                         style : 'padding-right:6px;',
                         href : 'javascript:void(0);', 
                         onclick : function() { 
-                            self.resetStore();
                             self.cachedQueryOpts.offset = self.displayOffset += self.displayLimit;
-                            if(self.dataLoader)
-                                self.dataLoader()
-                            else
-                                self.loadAll(self.cachedQueryOpts, self.cachedQuerySearch);
+                            self.refresh();
                         }
                     });
 
@@ -557,6 +549,14 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
                 this.setStore(this.buildAutoStore());
             },
 
+            refresh : function() {
+                this.resetStore();
+                if (this.dataLoader)
+                    this.dataLoader()
+                else
+                    this.loadAll(this.cachedQueryOpts, this.cachedQuerySearch);
+            },
+
             loadAll : function(opts, search) {
                 dojo.require('openils.PermaCrud');
                 if(this.loadProgressIndicator)