From 8831caefdf479c4afb6403aa0bc2ec5e22644c59 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 23 Apr 2012 12:34:56 -0400 Subject: [PATCH] Grid column picker repairs reloadStructure now only refreshes the column names (which was the original purpose of inserting the reload into flattenergrid) instead of refreshing the entire structure. this prevents losing visibility information that was collected from the user setting. Removed some inline CSS (min-height) which was apparently doing nothing. Signed-off-by: Bill Erickson --- .../web/js/dojo/openils/widget/GridColumnPicker.js | 24 ++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/Open-ILS/web/js/dojo/openils/widget/GridColumnPicker.js b/Open-ILS/web/js/dojo/openils/widget/GridColumnPicker.js index d0c86dbfd2..1d32bbe7d5 100644 --- a/Open-ILS/web/js/dojo/openils/widget/GridColumnPicker.js +++ b/Open-ILS/web/js/dojo/openils/widget/GridColumnPicker.js @@ -58,17 +58,29 @@ 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. + /** Loads any grid column label changes, clears any + * non-visible fields from the structure, and passes + * the structure back to the grid to force a UI refresh. */ reloadStructure : function() { - this.cells = this.structure[0].cells[0].slice(); + + // update our copy of the column labels + var _this = this; + dojo.forEach( + this.grid.structure[0].cells[0], + function(gcell) { + var cell = _this.cells.filter( + function(c) { return c.field == gcell.field } + )[0]; + cell.name = gcell.name; + } + ); + this.pruneInvisibleFields(); - this.structure = this.grid.structure; this.grid.setStructure(this.structure); }, + // determine the visible sorting from the // view and update our list of cells to match refreshCells : function() { @@ -115,7 +127,7 @@ if(!dojo._hasResource["openils.widget.GridColumnPicker"]) { "Auto WidthSort Priority" + ""}); - var tDiv = dojo.create('div', {style : 'min-height: 400px;'}); + var tDiv = dojo.create('div'); tDiv.appendChild(table); var bDiv = dojo.create('div', {style : 'text-align:right; width:100%;', -- 2.11.0