[open-ils-commits] r13234 - trunk/Open-ILS/web/js/dojo/openils/widget (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue May 26 13:46:52 EDT 2009


Author: erickson
Date: 2009-05-26 13:46:50 -0400 (Tue, 26 May 2009)
New Revision: 13234

Modified:
   trunk/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
   trunk/Open-ILS/web/js/dojo/openils/widget/GridColumnPicker.js
Log:
gave autogrid the ability to turn on the column picker

Modified: trunk/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js	2009-05-26 16:44:25 UTC (rev 13233)
+++ trunk/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js	2009-05-26 17:46:50 UTC (rev 13234)
@@ -5,6 +5,7 @@
     dojo.require('openils.widget.AutoFieldWidget');
     dojo.require('openils.widget.EditPane');
     dojo.require('openils.widget.EditDialog');
+    dojo.require('openils.widget.GridColumnPicker');
     dojo.require('openils.Util');
 
     dojo.declare(
@@ -19,6 +20,8 @@
             suppressFields : null,
             hideSelector : false,
             selectorWidth : '1.5',
+            showColumnPicker : false,
+            columnPickerPrefix : null,
 
             /* by default, don't show auto-generated (sequence) fields */
             showSequenceFields : false, 
@@ -31,8 +34,19 @@
                 this.initAutoEnv();
                 this.attr('structure', this._compileStructure());
                 this.setStore(this.buildAutoStore());
+
+                if(this.showColumnPicker) {
+                    if(!this.columnPickerPrefix) {
+                        console.error("No columnPickerPrefix defined");
+                    } else {
+                        new openils.widget.GridColumnPicker(
+                            openils.User.authtoken, this.columnPickerPrefix, this).load();
+                    }
+                }
+
                 this.overrideEditWidgets = {};
                 this.overrideEditWidgetClass = {};
+
                 if(this.editOnEnter) 
                     this._applyEditOnEnter();
                 else if(this.singleEditStyle) 
@@ -77,7 +91,8 @@
                         formatter : function(rowIdx) { return self._formatRowSelectInput(rowIdx); },
                         get : function(rowIdx, item) { if(item) return rowIdx; },
                         width : this.selectorWidth,
-                        name : '&#x2713'
+                        name : '&#x2713',
+                        nonSelectable : true
                     });
                 }
 

Modified: trunk/Open-ILS/web/js/dojo/openils/widget/GridColumnPicker.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/widget/GridColumnPicker.js	2009-05-26 16:44:25 UTC (rev 13233)
+++ trunk/Open-ILS/web/js/dojo/openils/widget/GridColumnPicker.js	2009-05-26 17:46:50 UTC (rev 13234)
@@ -144,9 +144,12 @@
                         var selector = dojo.query('[name=selector]', row)[0];
                         var width = dojo.query('[name=width]', row)[0];
                         if(selector.checked && selector.getAttribute('ident') == cell.field+''+cell.name) {
-                            if(width.checked)
+                            if(width.checked) {
                                 cell.width = 'auto';
-                            else delete cell.width;
+                            } else {
+                                if(cell.width == 'auto')
+                                    cell.width;
+                            }
                             newCellList.push(cell);
                         }
                     }
@@ -218,9 +221,12 @@
                 if(cell.selectableColumn) {
                     if(this._arrayHas(setting.columns, cell.field)) {
                         newCellList.push(cell);
-                        if(this._arrayHas(setting.auto, cell.field))
+                        if(this._arrayHas(setting.auto, cell.field)) {
                             cell.width = 'auto';
-                        else delete cell.width;
+                        } else {
+                            if(cell.width == 'auto')
+                                delete cell.width;
+                        }
                     }
                 }  else { // if it's not selectable, always show it
                     newCellList.push(cell); 



More information about the open-ils-commits mailing list