experiment 1
authorBill Erickson <berick@esilibrary.com>
Fri, 30 Mar 2012 16:09:10 +0000 (12:09 -0400)
committerBill Erickson <berick@esilibrary.com>
Fri, 30 Mar 2012 16:09:10 +0000 (12:09 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/web/js/dojo/openils/widget/FlattenerGrid.js

index 939cdac..0eb3105 100644 (file)
@@ -204,18 +204,6 @@ if (!dojo._hasResource["openils.widget.FlattenerGrid"]) {
             },
 
             "startup": function() {
-                if (!this.store) {
-                    this._setStore( /* this exact method chosen intentionally */
-                        new openils.FlattenerStore({
-                            "fmClass": this.fmClass,
-                            "fmIdentifier": this.fmIdentifier,
-                            "mapClause": (this.mapClause ||
-                                this._cleanMapForStore(this._generateMap())),
-                            "baseSort": this.baseSort,
-                            "defaultSort": this.defaultSort
-                        })
-                    );
-                }
 
                 /* Save original query for further filtering later */
                 this._baseQuery = dojo.clone(this.query);
@@ -224,10 +212,30 @@ if (!dojo._hasResource["openils.widget.FlattenerGrid"]) {
                     this.columnPicker =
                         new openils.widget.GridColumnPicker(
                             null, this.columnPersistKey, this);
+                    this.columnPicker.onLoad = dojo.hitch(
+                        this, function(opts) { this._finishStartup(opts.sortFields) });
                     this.columnPicker.load();
                 }
 
                 this.inherited(arguments);
+            },
+
+            "_finishStartup": function() {
+
+                if (!this.store) {
+                    this.setStore( /* this exact method chosen intentionally */
+                        new openils.FlattenerStore({
+                            "fmClass": this.fmClass,
+                            "fmIdentifier": this.fmIdentifier,
+                            "mapClause": (this.mapClause ||
+                                this._cleanMapForStore(this._generateMap())),
+                            "baseSort": this.baseSort,
+                            "defaultSort": this.defaultSort
+                        })
+                    );
+                }
+
+                //this.inherited(arguments);
 
                 this._startupGridHelperColumns();
 
@@ -247,6 +255,7 @@ if (!dojo._hasResource["openils.widget.FlattenerGrid"]) {
                 this._setupLinks();
             },
 
+
             "_setupLinks": function() {
                 this.linkHolder = new dijit.layout.ContentPane();
                 dojo.place(this.linkHolder.domNode, this.domNode, "before");