From: Bill Erickson Date: Mon, 23 Apr 2012 16:34:56 +0000 (-0400) Subject: Grid column picker repairs X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fcollab%2Fsenator%2Fsimplified-hpl;p=working%2FEvergreen.git 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 --- 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%;',