[open-ils-commits] r13123 - in trunk/Open-ILS/web: js/dojo/openils/widget templates/default/acq/financial (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon May 11 09:59:26 EDT 2009


Author: erickson
Date: 2009-05-11 09:59:24 -0400 (Mon, 11 May 2009)
New Revision: 13123

Modified:
   trunk/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
   trunk/Open-ILS/web/templates/default/acq/financial/list_funding_sources.tt2
Log:
dojo-1.3 treats HTML from a grid getter as raw text, but it will let you return HTML from a formatter.  fixed the autogrid selector cell.  tweaked fuding_source list as well.  i'm sure there are more UI's to track down

Modified: trunk/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js	2009-05-11 01:50:43 UTC (rev 13122)
+++ trunk/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js	2009-05-11 13:59:24 UTC (rev 13123)
@@ -74,7 +74,8 @@
                     // 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 @@
                 );
             },
 
-            _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 + "'/>";
             },
 

Modified: trunk/Open-ILS/web/templates/default/acq/financial/list_funding_sources.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/financial/list_funding_sources.tt2	2009-05-11 01:50:43 UTC (rev 13122)
+++ trunk/Open-ILS/web/templates/default/acq/financial/list_funding_sources.tt2	2009-05-11 13:59:24 UTC (rev 13123)
@@ -9,8 +9,16 @@
         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>
 
 <div dojoType="dijit.layout.ContentPane" layoutAlign="client">
@@ -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>



More information about the open-ils-commits mailing list