[open-ils-commits] r11483 - 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
Tue Dec 9 18:07:53 EST 2008


Author: erickson
Date: 2008-12-09 18:07:48 -0500 (Tue, 09 Dec 2008)
New Revision: 11483

Modified:
   trunk/Open-ILS/web/js/ui/default/acq/financial/list_funding_sources.js
   trunk/Open-ILS/web/templates/default/acq/financial/list_funding_sources.tt2
Log:
moved to 1.2-style dojo grid

Modified: trunk/Open-ILS/web/js/ui/default/acq/financial/list_funding_sources.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/financial/list_funding_sources.js	2008-12-09 22:04:18 UTC (rev 11482)
+++ trunk/Open-ILS/web/js/ui/default/acq/financial/list_funding_sources.js	2008-12-09 23:07:48 UTC (rev 11483)
@@ -4,30 +4,30 @@
 dojo.require('openils.acq.CurrencyType');
 dojo.require('openils.widget.OrgUnitFilteringSelect');
 dojo.require('dijit.form.Button');
-dojo.require('dojox.grid.Grid');
+dojo.require('dojo.data.ItemFileReadStore');
+dojo.require('dojox.grid.DataGrid');
 dojo.require('openils.Event');
 dojo.require('openils.Util');
 
-function getOrgInfo(rowIndex) {
-    data = fundingSourceListGrid.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 getBalanceInfo(rowIndex) {
-    data = fundingSourceListGrid.model.getRow(rowIndex);
-    if(!data) return;
-    return new String(openils.acq.FundingSource.cache[data.id].summary().balance);
+function getBalanceInfo(rowIndex, item) {
+    if(!item) return '';
+    var data = this.grid.store.getValue( item, 'id');   
+    return new String(openils.acq.FundingSource.cache[data].summary().balance);
 }
 
 function loadFSGrid() {
     openils.acq.FundingSource.createStore(
         function(storeData) {
             var store = new dojo.data.ItemFileReadStore({data:storeData});
-            var model = new dojox.grid.data.DojoData(null, store, 
-                {rowsPerPage: 20, clientSort: true, query:{id:'*'}});
-            fundingSourceListGrid.setModel(model);
-            fundingSourceListGrid.update();
+            fundingSourceListGrid.setStore(store);
+            fundingSourceListGrid.render();
         }
     );
 }

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	2008-12-09 22:04:18 UTC (rev 11482)
+++ trunk/Open-ILS/web/templates/default/acq/financial/list_funding_sources.tt2	2008-12-09 23:07:48 UTC (rev 11483)
@@ -77,22 +77,28 @@
 
 <!-- The main grid lives here -->
 <script>
-    function getName(rowIndex) {
-        data = fundingSourceListGrid.model.getRow(rowIndex);
-        if(!data) return;
-        return '<a href="[% ctx.base_uri %]/acq/funding_source/view/'+data.id+'">'+data.name+'</a>';
+    function getName(rowIndex, item) {
+        if(!item) return '';
+        var name = this.grid.store.getValue(item, 'name');        
+        var id = this.grid.store.getValue(item, 'id');
+        return '<a href="[% ctx.base_uri %]/acq/funding_source/view/'+id+'">'+name+'</a>';
     }
-
-    var fsGridStructure = [{
-        cells : [[
-            {name: 'ID', field: 'id'},
-            {name: 'Name', width:'auto', get:getName}, 
-            {name: 'Code', field:'code'},
-            {name: 'Owner', width:'auto', get:getOrgInfo}, 
-            {name: 'Currency Type', field: "currency_type"},
-            {name: 'Balance', get:getBalanceInfo}
-        ]]
-    }];
 </script>
-<div id="oils-acq-funding-source-list-grid" jsId='fundingSourceListGrid' dojoType="dojox.Grid" structure='fsGridStructure'></div>
+<div dojoType="dijit.layout.ContentPane" layoutAlign="top"> 
+     <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'> 
+         <table jsId="fundingSourceListGrid" dojoType="dojox.grid.DataGrid" query="{id: '*'}" rowSelector='20px'>
+            <thead> 
+                <tr> 
+                    <th field="id">ID</th> 
+                    <th field="name" width='auto' get='getName'>Name</th> 
+                    <th field="owner" width='auto'get='getOrgInfo'>Owner</th> 
+                    <th field="code" width='auto'>Code</th>
+                    <th field="currency_type" width='auto'>Currency Type</th> 
+                    <th field="balance" width='auto' get='getBalanceInfo'>Balance</th> 
+                </tr> 
+            </thead> 
+        </table>     
+    </div> 
+</div> 
+ 
 [% END %]



More information about the open-ils-commits mailing list