grid getter fixes for 1.3
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 5 Jun 2009 15:35:17 +0000 (15:35 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 5 Jun 2009 15:35:17 +0000 (15:35 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@13326 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/ui/default/conify/global/acq/distribution_formula.js
Open-ILS/web/templates/default/conify/global/acq/distribution_formula.tt2

index eee01e4..f1ec776 100644 (file)
@@ -51,10 +51,3 @@ function getItemCount(rowIndex, item) {
     return count;
 }
 
-function getFormulaName(rowIndex, item) {
-    if(!item) return '';
-    return '<a href="' + location.href + '/' +
-        this.grid.store.getValue(item, 'id') + '">' +
-        this.grid.store.getValue(item, 'name') + '</a>';
-}
-
index a34fc1a..a81fde2 100644 (file)
@@ -1,6 +1,24 @@
 [% WRAPPER default/base.tt2 %]
 <script src='[% ctx.media_prefix %]/js/ui/default/conify/global/acq/distribution_formula.js'> </script>
-<script> var formulaId = '[% ctx.page_args.0 %]';</script>
+<script> var formulaId = '[% ctx.page_args.0 %]';
+
+function getFormulaName(rowIndex, item) {
+        if(!item) return '';
+        var name = this.grid.store.getValue(item, 'name');
+        var id = this.grid.store.getValue(item, 'id');
+        return id + ':' + name;
+    }
+
+function formatName(value) {
+        if(value) {
+            var vals = value.split(/:/);
+            return '<a href="'+location.href+ '/'+vals[0]+'">'+vals[1]+'</a>';
+        }
+}
+
+</script>
+
+
 
 
 <div id='formula-list-div'>
@@ -22,7 +40,7 @@
                 editOnEnter='true'>
             <thead>
                 <tr>
-                    <th field='name' get='getFormulaName'/>
+                    <th field='name' get='getFormulaName' formatter='formatName'/>
                     <th field='item_count' get='getItemCount'/>
                 </tr>
             </thead>
@@ -38,9 +56,9 @@
     </div>
         <div dojoType="dijit.layout.ContentPane" layoutAlign="client" class='oils-header-panel'>
             <div id="formula_head"></div>
-            <div> 
+            <div>
                 <button dojoType='dijit.form.Button' onClick='dfeListGrid.showCreateDialog()'>New Formula Entry</button>
-                <button dojoType='dijit.form.Button' onClick='dfeListGrid.deleteSelected()'>Delete Selected</button> 
+                <button dojoType='dijit.form.Button' onClick='dfeListGrid.deleteSelected()'>Delete Selected</button>
             </div>
         </div>
         <div dojoType="dijit.layout.ContentPane" layoutAlign="client">
                     editOnEnter='true'>
                 <thead>
                     <tr>
-                        <th field='formula' get='getFormulaId'/>
+                        <th field='formula' get='getFormulaId' formatter='formatName'/>
                     </tr>
                 </thead>
             </table>
-            <div/>
         </div>
     </div>
 </div>