[open-ils-commits] r11515 - 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:03:41 EST 2008


Author: erickson
Date: 2008-12-11 11:03:39 -0500 (Thu, 11 Dec 2008)
New Revision: 11515

Modified:
   trunk/Open-ILS/web/js/ui/default/acq/financial/view_provider.js
   trunk/Open-ILS/web/templates/default/acq/financial/view_provider.tt2
Log:
mostly moved to markup grid

Modified: trunk/Open-ILS/web/js/ui/default/acq/financial/view_provider.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/financial/view_provider.js	2008-12-11 16:03:31 UTC (rev 11514)
+++ trunk/Open-ILS/web/js/ui/default/acq/financial/view_provider.js	2008-12-11 16:03:39 UTC (rev 11515)
@@ -2,7 +2,8 @@
 dojo.require('dijit.layout.TabContainer');
 dojo.require('dijit.layout.ContentPane');
 dojo.require('dijit.form.FilteringSelect');
-dojo.require('dojox.grid.Grid');
+dojo.require('dojox.grid.DataGrid');
+dojo.require('dojo.data.ItemFileReadStore');
 dojo.require("fieldmapper.OrgUtils");
 dojo.require('openils.acq.Provider');
 dojo.require('openils.Event');
@@ -12,31 +13,30 @@
 var provider = null;
 var marcRegex = /^\/\/\*\[@tag="(\d+)"]\/\*\[@code="(\w)"]$/;
 
-function getOrgInfo(rowIndex) {
-    data = providerGrid.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 getTag(rowIdx) {
-    data = padGrid.model.getRow(rowIdx);
-    if(!data) return;
-    return data.xpath.replace(marcRegex, '$1');
+function getTag(rowIdx, item) {
+    if(!item) return '';
+    var xpath = this.grid.store.getValue(item, 'xpath');
+    return xpath.replace(marcRegex, '$1');
 }
 
-function getSubfield(rowIdx) {
-    data = padGrid.model.getRow(rowIdx);
-    if(!data) return;
-    return data.xpath.replace(marcRegex, '$2');
+function getSubfield(rowIdx, item) {
+    if(!item) return '';
+    var xpath = this.grid.store.getValue(item, 'xpath');
+    return xpath.replace(marcRegex, '$2');
 }
 
-
 function loadProviderGrid() {
     var store = new dojo.data.ItemFileReadStore({data:acqpro.toStoreData([provider])});
-    var model = new dojox.grid.data.DojoData(
-        null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}});
-    providerGrid.setModel(model);
-    providerGrid.update();
+   
+    providerGrid.setStore(store);
+    providerGrid.render();
 }
 
 function loadPADGrid() {

Modified: trunk/Open-ILS/web/templates/default/acq/financial/view_provider.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/financial/view_provider.tt2	2008-12-11 16:03:31 UTC (rev 11514)
+++ trunk/Open-ILS/web/templates/default/acq/financial/view_provider.tt2	2008-12-11 16:03:39 UTC (rev 11515)
@@ -4,25 +4,26 @@
 
 <div dojoType="dijit.layout.ContentPane" layoutAlign="top">
     <div dojoType="dijit.layout.TabContainer">
+
         <div dojoType="dijit.layout.ContentPane" 
                 class='oils-acq-detail-content-pane' title="Summary" selected='true' style='height:400px;'>
-            <script>
-                var providerGridLayout = [{
-                    cells : [[
-                        {name: 'ID', field: 'id'},
-                        {name: 'Name', field: "name", width:'auto'}, 
-                        {name: 'Code', field:'code'},
-                        {name: 'Owner', get:getOrgInfo}, 
-                        {name: 'Currency Type', field: "currency_type"},
-                    ]]
-                }];
-            </script>
-            <div jsId='providerGrid' dojoType="dojox.Grid" structure='providerGridLayout'> </div>
+            <div dojoType="dijit.layout.ContentPane" layoutAlign="top"> 
+                <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'> 
+                    <table jsId="providerGrid" 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="owner" get='getOrgInfo'>Owner</th> 
+                                <th field="currency_type">Currency Type</th> 
+                            </tr> 
+                        </thead> 
+                    </table>     
+                </div> 
+            </div>             
         </div>
 
-        <!--
-            Provider order record data types
-        -->
         <div dojoType="dijit.layout.ContentPane" 
                 class='oils-acq-detail-content-pane' title="Order Record Format" style='height:400px;'>
 
@@ -80,7 +81,7 @@
                             </tr>
                             <tr>
                                 <td colspan='2' align='center'>
-                                    <button dojoType=dijit.form.Button type="submit">Apply</button>
+                                    <button dojoType='dijit.form.Button' type="submit">Apply</button>
                                 </td>
                             </tr>
                         </table>
@@ -96,22 +97,22 @@
             </div>
 
             <script type='dojo/connect' event='onShow'>loadPADGrid();</script>
-            <script>
-                var padGridLayout = [{
-                    cells : [[
-                        {name: 'ID', field: 'id'},
-                        {name: 'Code', field:'code', width:'auto'},
-                        {name: 'Description', field: "description", width:'auto'}, 
-                        {name: 'Tag', get:getTag},
-                        {name: 'Subfield', get:getSubfield},
-                        {name: 'Identifier', field:'ident'},
-                        {name: 'XPath', field:'xpath', width:'auto'}
-                    ]]
-                }];
-            </script>
-            <div jsId='padGrid' dojoType="dojox.Grid" structure='padGridLayout'> </div>
+            <div dojoType="dijit.layout.ContentPane" layoutAlign="top"> 
+                <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'> 
+                    <table jsId="padGrid" dojoType="dojox.grid.DataGrid" query="{id: '*'}" rowSelector='20px'> 
+                        <thead> 
+                            <tr> 
+                                <th field="id">ID</th> 
+                                <th field="code" width='auto'>Code</th> 
+                                <th field="description" width='auto'>Description</th>                                 
+                                <th field="tag" get='getTag'>Tag</th> 
+                                <th field="subfield" get='getSubfield'>Subfield</th> 
+                                <th field="xpath" width='auto'>XPath</th> 
+                            </tr> 
+                        </thead> 
+                    </table>     
+                </div> 
+            </div>             
         </div>
-    </div>
-</div>
 [% END %]
 



More information about the open-ils-commits mailing list