FlattenerGrid (re)honors IDL column labels as default
authorBill Erickson <berick@esilibrary.com>
Mon, 2 Apr 2012 14:19:02 +0000 (10:19 -0400)
committerMike Rylander <mrylander@gmail.com>
Mon, 2 Apr 2012 14:47:17 +0000 (10:47 -0400)
Linking the GridColumnPicker to FlattenerGrid killed the ability for the
FlattenerGrid to fall back to the IDL column label when no label was
defined in the markup.  This change adds a reloadStructure operation to
GridColumnPicker.  FlattenerGrid uses this to pass the updated column
labels (and any other changes) to gridcolumnpicker, which then updates
the grid display to match.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/web/js/dojo/openils/widget/FlattenerGrid.js
Open-ILS/web/js/dojo/openils/widget/GridColumnPicker.js

index b3ea3f1..a18cd4a 100644 (file)
@@ -298,6 +298,9 @@ if (!dojo._hasResource["openils.widget.FlattenerGrid"]) {
                     }), this.query
                 );
 
+                // pick up any column label changes
+                this.columnPicker.reloadStructure();
+
                 this._showing_create_pane = false;
 
                 this.overrideEditWidgets = {};
index 250bca5..9cc367d 100644 (file)
@@ -58,6 +58,16 @@ if(!dojo._hasResource["openils.widget.GridColumnPicker"]) {
             };
         },
 
+        /** Loads the current grid structure and passes the 
+         *  structure back to the grid to force a UI refresh.
+         *  This is necessary if external forces alter the structure. 
+         */
+        reloadStructure : function() {
+            this.structure = this.grid.structure;
+            this.cells = this.structure[0].cells[0].slice();
+            this.grid.setStructure(this.structure);
+        },
+
         // determine the visible sorting from the 
         // view and update our list of cells to match
         refreshCells : function() {