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

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Jun 4 13:45:45 EDT 2009


Author: erickson
Date: 2009-06-04 13:45:42 -0400 (Thu, 04 Jun 2009)
New Revision: 13316

Modified:
   trunk/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
Log:
make the selector cell onclick handler more dojo-y.  added support for disabling selector cell based on user-defined callback.

Modified: trunk/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js	2009-06-04 17:44:39 UTC (rev 13315)
+++ trunk/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js	2009-06-04 17:45:42 UTC (rev 13316)
@@ -53,9 +53,12 @@
                     this._applySingleEditStyle();
 
                 if(!this.hideSelector) {
-                    var header = this.layout.cells[0].view.getHeaderCellNode(0);
-                    var self = this;
-                    header.onclick = function() { self.toggleSelectAll(); }
+                    dojo.connect(this, 'onHeaderCellClick', 
+                        function(e) {
+                            if(e.cell.index == 0)
+                                this.toggleSelectAll();
+                        }
+                    );
                 }
             },
 
@@ -180,7 +183,8 @@
                 var inputs = dojo.query('[name=autogrid.selector]', this.domNode);
                 for(var i = 0; i < inputs.length; i++) {
                     if(inputs[i].getAttribute('row') == rowIdx) {
-                        inputs[i].checked = true;
+                        if(!inputs[i].disabled)
+                            inputs[i].checked = true;
                         break;
                     }
                 }
@@ -227,7 +231,10 @@
 
             _formatRowSelectInput : function(rowIdx) {
                 if(rowIdx === null || rowIdx === undefined) return '';
-                return "<input type='checkbox' name='autogrid.selector' row='" + rowIdx + "'/>";
+                var s = "<input type='checkbox' name='autogrid.selector' row='" + rowIdx + "'";
+                if(this.disableSelectorForRow && this.disableSelectorForRow(rowIdx)) 
+                    s += " disabled='disabled'";
+                return s + "/>";
             },
 
             _applySingleEditStyle : function() {



More information about the open-ils-commits mailing list