make the selector cell onclick handler more dojo-y. added support for disabling...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 4 Jun 2009 17:45:42 +0000 (17:45 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 4 Jun 2009 17:45:42 +0000 (17:45 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@13316 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/dojo/openils/widget/AutoGrid.js

index 975917f..40fc62d 100644 (file)
@@ -53,9 +53,12 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
                     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 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
                 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 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
 
             _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() {