added some grid autoheight handling. small bug fixes on creation. other small cleanup
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 11 May 2009 00:55:40 +0000 (00:55 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 11 May 2009 00:55:40 +0000 (00:55 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@13116 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
Open-ILS/web/templates/default/conify/global/acq/exchange_rate.tt2

index 61077af..eee01e4 100644 (file)
@@ -3,40 +3,35 @@ dojo.require('dijit.form.FilteringSelect');
 dojo.require('openils.PermaCrud');
 var formula;
 var formCache = [];
+
 function draw() {
+
     if(formulaId) {
         openils.Util.hide('formula-list-div');
         drawFormulaSummary();
     } else {
+
         openils.Util.hide('formula-entry-div');
         fListGrid.onPostCreate = function(fmObject) {
             location.href = location.href + '/' + fmObject.id();
         }
- fieldmapper.standardRequest(
-                ['open-ils.acq', 'open-ils.acq.distribution_formula.ranged.retrieve'],
-                {   async: true,
-                    params: [openils.User.authtoken],
-                    onresponse: function (r) { 
-                        var form = openils.Util.readResponse(r);
-                        formCache[form.id()] = form;
-                        fListGrid.store.newItem(form.toStoreItem());
-                        }
-                    }
-                             );
-     
+
+        fieldmapper.standardRequest(
+            ['open-ils.acq', 'open-ils.acq.distribution_formula.ranged.retrieve'],
+            {   async: true,
+                params: [openils.User.authtoken],
+                onresponse: function (r) { 
+                    var form = openils.Util.readResponse(r);
+                    formCache[form.id()] = form;
+                    fListGrid.store.newItem(form.toStoreItem());
+                }
+            }
+        );
+
     }
 }
 openils.Util.addOnLoad(draw);
 
-/*function getFormulaId (rowIndex, item) {
-    if(!item) return '';
-    var pcrud = new openils.PermaCrud;
-    var formulaName = pcrud.retrieve('acqdf', formulaId);
-    return formulaName.name();
-    
-
-}
-*/
 function drawFormulaSummary() {
     openils.Util.show('formula-entry-div');
     dfeListGrid.overrideEditWidgets.formula = new
@@ -50,12 +45,9 @@ function drawFormulaSummary() {
 function getItemCount(rowIndex, item) {
     if(!item) return '';
     var form = formCache[this.grid.store.getValue(item, "id")];
+    if(!form) return 0;
     var count = 0;
-    dojo.forEach(form.entries(),
-                 function(e) {
-                     count = count + e.item_count();
-                 }
-                 );
+    dojo.forEach(form.entries(), function(e) { count = count + e.item_count(); });
     return count;
 }
 
index ae40940..a34fc1a 100644 (file)
@@ -5,7 +5,7 @@
 
 <div id='formula-list-div'>
     <div dojoType="dijit.layout.ContentPane" layoutAlign="client">
-        <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
+        <div dojoType="dijit.layout.ContentPane" layoutAlign="client" class='oils-header-panel'>
             <div>Distribution Formulas</div>
             <div>
                 <button dojoType='dijit.form.Button' onClick='fListGrid.showCreateDialog()'>New Formula</button>
@@ -13,6 +13,7 @@
             </div>
         </div>
         <table  jsId="fListGrid"
+                autoHeight='true'
                 dojoType="openils.widget.AutoGrid"
                 fieldOrder="['id', 'name', 'owner', 'item_count', 'skip_count']"
                 query="{id: '*'}"
 
 
 <div id='formula-entry-div'>
-    <div dojoType="dijit.layout.ContentPane" layoutAlign="top">
+    <div dojoType="dijit.layout.ContentPane" layoutAlign="client">
         <div id='formula-summary-pane'/>
     </div>
-        <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
+        <div dojoType="dijit.layout.ContentPane" layoutAlign="client" class='oils-header-panel'>
             <div id="formula_head"></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> 
             </div>
         </div>
-        <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:400px'>
+        <div dojoType="dijit.layout.ContentPane" layoutAlign="client">
             <table  jsId="dfeListGrid"
+                    autoHeight='true'
                     dojoType="openils.widget.AutoGrid"
                     fieldOrder="['id','formula', 'owning_lib', 'location', 'item_count', 'position']"
                     suppressFields="['formula']"
@@ -57,6 +59,7 @@
                     </tr>
                 </thead>
             </table>
+            <div/>
         </div>
     </div>
 </div>
index e98ef07..9a14771 100644 (file)
@@ -14,8 +14,9 @@
         <button dojoType='dijit.form.Button' onClick='erGrid.deleteSelected()'>Delete Selected</button>
     </div>
 </div>
-<div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'>
+<div dojoType="dijit.layout.ContentPane" layoutAlign="client">
     <table  jsId="erGrid"
+            autoHeight='true'
             dojoType="openils.widget.AutoGrid"
             fieldOrder="['id', 'from_currency', 'to_currency', 'ratio']"
             defaultCellWidth='12'
@@ -23,6 +24,7 @@
             fmClass='acqexr'
             editOnEnter='true'>
     </table>
+    <div/>
 </div>
 [% END %]