[open-ils-commits] r11522 - in trunk/Open-ILS/web: js/ui/default/acq/financial templates/default/acq/financial

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Dec 11 11:08:53 EST 2008


Author: erickson
Date: 2008-12-11 11:08:51 -0500 (Thu, 11 Dec 2008)
New Revision: 11522

Modified:
   trunk/Open-ILS/web/js/ui/default/acq/financial/view_funding_source.js
   trunk/Open-ILS/web/templates/default/acq/financial/view_funding_source.tt2
Log:
move to 1.2 markup grid

Modified: trunk/Open-ILS/web/js/ui/default/acq/financial/view_funding_source.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/financial/view_funding_source.js	2008-12-11 16:07:36 UTC (rev 11521)
+++ trunk/Open-ILS/web/js/ui/default/acq/financial/view_funding_source.js	2008-12-11 16:08:51 UTC (rev 11522)
@@ -4,8 +4,8 @@
 dojo.require("dijit.form.FilteringSelect");
 dojo.require("dijit.form.Textarea");
 dojo.require("dijit.form.CurrencyTextBox");
-dojo.require('dojox.grid.Grid');
-
+dojo.require('dojox.grid.DataGrid');
+dojo.require('dojo.data.ItemFileReadStore');
 dojo.require("fieldmapper.OrgUtils");
 dojo.require('openils.acq.FundingSource');
 dojo.require('openils.acq.Fund');
@@ -57,10 +57,11 @@
 }
 
 /** Some grid rendering accessor functions ----- */
-function getOrgInfo(rowIndex) {
-    data = fundingSourceGrid.model.getRow(rowIndex);
-    if(!data) return;
-    return fieldmapper.aou.findOrgUnit(data.owner).shortname();
+function getOrgInfo(rowIndex, item) {
+    if(!item) return ''; 
+    var owner = this.grid.store.getValue(item, 'owner'); 
+    return fieldmapper.aou.findOrgUnit(owner).shortname();
+
 }
 
 function getSummaryInfo(rowIndex) {
@@ -71,19 +72,20 @@
 function loadFSGrid() {
     if(!fundingSource) return;
     var store = new dojo.data.ItemFileReadStore({data:acqfs.toStoreData([fundingSource])});
-    var model = new dojox.grid.data.DojoData(null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}});
-    fundingSourceGrid.setModel(model);
-    fundingSourceGrid.update();
+
+    fundingSourceGrid.setStore(store);
+    fundingSourceGrid.render();
 }
 
 
 /** builds the credits grid ----- */
 function loadCreditGrid() {
     if(fsCreditGrid.isLoaded) return;
+ 
     var store = new dojo.data.ItemFileReadStore({data:acqfa.toStoreData(fundingSource.credits())});
-    var model = new dojox.grid.data.DojoData(null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}});
-    fsCreditGrid.setModel(model);
-    fsCreditGrid.update();
+   
+    fsCreditGrid.setStore(store);
+    fsCreditGrid.render();
     fsCreditGrid.isLoaded = true;
 }
 
@@ -91,9 +93,9 @@
 function loadAllocationGrid() {
     if(fsAllocationGrid.isLoaded) return;
     var store = new dojo.data.ItemFileReadStore({data:acqfa.toStoreData(fundingSource.allocations())});
-    var model = new dojox.grid.data.DojoData(null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}});
-    fsAllocationGrid.setModel(model);
-    fsAllocationGrid.update();
+
+    fsAllocationGrid.setStore(store);
+    fsAllocationGrid.render();
     fsAllocationGrid.isLoaded = true;
 }
 

Modified: trunk/Open-ILS/web/templates/default/acq/financial/view_funding_source.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/financial/view_funding_source.tt2	2008-12-11 16:07:36 UTC (rev 11521)
+++ trunk/Open-ILS/web/templates/default/acq/financial/view_funding_source.tt2	2008-12-11 16:08:51 UTC (rev 11522)
@@ -108,55 +108,64 @@
     <div dojoType="dijit.layout.TabContainer">
         <div dojoType="dijit.layout.ContentPane" class='oils-acq-detail-content-pane' title="Summary" selected='true'>
             <script type='dojo/connect' event='onShow'>loadFSGrid();</script>
-            <script>
-                /** Define the columns for the funding source grid ----- */
-                var fundingSourceGridLayout = [{
-                    cells : [[
-                        {name: 'ID', field: 'id'},
-                        {name: 'Name', field: "name", width:'auto'}, 
-                        {name: 'Code', field: "code"},
-                        {name: 'Balance', get:getSummaryInfo, field:'balance'},
-                        {name: 'Total Credits', get:getSummaryInfo, field:'credit_total'},
-                        {name: 'Total Debits', get:getSummaryInfo, field:'allocation_total'},
-                        {name: 'Currency Type', field: "currency_type"},
-                        {name: 'Owner', field: "owner", width:'auto', get:getOrgInfo}, 
-                    ]]
-                }];
-            </script>
-            <div jsId='fundingSourceGrid' dojoType="dojox.Grid" structure='fundingSourceGridLayout'> </div>
-        </div>
+
+            <div dojoType="dijit.layout.ContentPane" layoutAlign="top"> 
+                <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'> 
+                    <table jsId="fundingSourceGrid" dojoType="dojox.grid.DataGrid" query="{id: '*'}" rowSelector='20px'> 
+                        <thead> 
+                            <tr> 
+                                <th field="id">ID</th> 
+                                <th field="name" width='auto'>Name</th> 
+                                <th field="code">Code</th> 
+                                <th field="balance" get='getSummaryInfo'>Balance</th>
+                                <th field="credit_totals" get='getSummaryInfo'>Total Credits</th>
+                                <th field="allocation_total" get='getSummaryInfo'>Total Debits</th>
+                                <th field="currency_type">Currency Type</th> 
+                                <th field="owner" width='auto' get='getOrgInfo'>Owner</th>
+                            </tr> 
+                        </thead> 
+                    </table>     
+                </div> 
+            </div>               
+ 
         <div dojoType="dijit.layout.ContentPane" class='oils-acq-detail-content-pane' title="Credits">
-            <script type='dojo/connect' event='onShow'>loadCreditGrid();</script>
-            <script>
-                /** Define the columns for the funding source credits grid ----- */
-                var fsCreditGridLayout = [{
-                    cells : [[
-                        {name: 'ID', field: 'id'},
-                        {name: 'Amount', field: "amount"}, 
-                        {name: 'Note', field: "note", width:'auto'}, 
-                    ]]
-                }];
-            </script>
-            <div jsId='fsCreditGrid' dojoType="dojox.Grid" structure='fsCreditGridLayout'> </div>
-        </div>
+            <script type='dojo/connect' event='onShow'>loadCreditGrid();
+            </script> 
+            <div dojoType="dijit.layout.ContentPane" layoutAlign="top"> 
+                <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'> 
+                    <table jsId="fsCreditGrid" dojoType="dojox.grid.DataGrid" query="{id: '*'}" rowSelector='20px'> 
+                        <thead> 
+                            <tr> 
+                                <th field="id">ID</th> 
+                                <th field="amount">Amount</th> 
+                                <th field="note" width='auto'>Note</th> 
+                            </tr> 
+                        </thead> 
+                    </table>     
+                </div> 
+            </div> 
+            
         <div dojoType="dijit.layout.ContentPane" class='oils-acq-detail-content-pane' title="Allocations">
-            <script type='dojo/connect' event='onShow'>loadAllocationGrid();</script>
-            <script>
-                /** Define the columns for the funding source allocations grid ----- */
-                var fsAllocationGridLayout = [{
-                    cells : [[
-                        {name: 'ID', field: 'id'},
-                        {name: 'Fund', field: "fund", get:getFund}, 
-                        {name: 'Amount', field: "amount"}, 
-                        {name: 'Percent', field: "percent"}, 
-                        {name: 'Allocated By', field: "allocator"}, 
-                        {name: 'Note', field: "note", width:'auto'}, 
-                    ]]
-                }];
-            </script>
-            <div jsId='fsAllocationGrid' dojoType="dojox.Grid" structure='fsAllocationGridLayout'> </div>
+            <script type='dojo/connect' event='onShow'>loadAllocationGrid();</script> 
+            <div dojoType="dijit.layout.ContentPane" layoutAlign="top"> 
+                <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'> 
+                    <table jsId="fsAllocationGrid" dojoType="dojox.grid.DataGrid" query="{id: '*'}" rowSelector='20px'> 
+                        <thead> 
+                            <tr> 
+                                <th field="id">ID</th> 
+                                <th field="fund" get='getFund'>Fund</th> 
+                                <th field="amount">Amount</th> 
+                                <th field="percent">Percent</th> 
+                                <th field="allocator">Allocated By</th> 
+                                <th field="note" width='auto'>Note</th> 
+                            </tr> 
+                        </thead> 
+                    </table>     
+                </div> 
+            </div> 
         </div>
     </div>
 </div>
+
 [% END %]
 



More information about the open-ils-commits mailing list