dojo-1.3 treats HTML from a grid getter as raw text, but it will let you return HTML...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 11 May 2009 13:59:24 +0000 (13:59 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 11 May 2009 13:59:24 +0000 (13:59 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@13123 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
Open-ILS/web/templates/default/acq/financial/list_funding_sources.tt2

index 7db33cd..b7f19cb 100644 (file)
@@ -74,7 +74,8 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
                     // insert the selector column
                     pushEntry({
                         field : '+selector',
-                        get : function(rowIdx, item) { return self._buildRowSelectInput(rowIdx, item); },
+                        formatter : function(rowIdx) { return self._formatRowSelectInput(rowIdx); },
+                        get : function(rowIdx, item) { if(item) return rowIdx; },
                         width : this.selectorWidth,
                         name : '&#x2713'
                     });
@@ -194,8 +195,9 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
                 );
             },
 
-            _buildRowSelectInput : function(rowIdx, item) {
-                if(!item) return '';
+            _formatRowSelectInput : function(rowIdx) {
+                if(rowIdx === null || rowIdx === undefined) return '';
+                console.log("<input type='checkbox' name='autogrid.selector' row='" + rowIdx + "'/>");
                 return "<input type='checkbox' name='autogrid.selector' row='" + rowIdx + "'/>";
             },
 
index 172ef19..f7dbd3e 100644 (file)
@@ -9,7 +9,15 @@
         if(!item) return '';
         var name = this.grid.store.getValue(item, 'name');
         var id = this.grid.store.getValue(item, 'id');
-        return '<a href="[% ctx.base_path %]/acq/funding_source/view/'+id+'">'+name+'</a>';
+        // weird hack to pass the data we need to the formatter which is now required for HTML cell values
+        return id + ':' + name;
+    }
+
+    function formatName(value) {
+        if(value) {
+            var vals = value.split(/:/);
+            return '<a href="[% ctx.base_path %]/acq/funding_source/view/'+vals[0]+'">'+vals[1]+'</a>';
+        }
     }
 </script>
 
@@ -32,7 +40,7 @@
             editOnEnter='true'>
         <thead>
             <tr>
-                <th field="name" get='getName'/>
+                <th field="name" get='getName' formatter='formatName'/>
                 <th field="owner" get='getOrgInfo'/>
                 <th field="balance" get='getBalanceInfo'/>
             </tr>