[open-ils-commits] r11520 - in trunk/Open-ILS/web: js/ui/default/acq/po templates/default/acq/po
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Dec 11 11:07:14 EST 2008
Author: erickson
Date: 2008-12-11 11:07:12 -0500 (Thu, 11 Dec 2008)
New Revision: 11520
Modified:
trunk/Open-ILS/web/js/ui/default/acq/po/view_po.js
trunk/Open-ILS/web/templates/default/acq/po/view.tt2
Log:
move to 1.2 markup grid
Modified: trunk/Open-ILS/web/js/ui/default/acq/po/view_po.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/po/view_po.js 2008-12-11 16:07:10 UTC (rev 11519)
+++ trunk/Open-ILS/web/js/ui/default/acq/po/view_po.js 2008-12-11 16:07:12 UTC (rev 11520)
@@ -2,7 +2,8 @@
dojo.require('dijit.form.FilteringSelect');
dojo.require('dijit.layout.TabContainer');
dojo.require('dijit.layout.ContentPane');
-dojo.require('dojox.grid.Grid');
+dojo.require('dojox.grid.DataGrid');
+dojo.require('dojo.data.ItemFileReadStore');
dojo.require('openils.acq.PO');
dojo.require('openils.Event');
dojo.require('openils.User');
@@ -16,38 +17,36 @@
var PO = null;
var lineitems = [];
-function getOrgInfo(rowIndex) {
- data = poGrid.model.getRow(rowIndex);
- if(!data) return;
- return fieldmapper.aou.findOrgUnit(data.owner).shortname();
+function getOrgInfo(rowIndex, item) {
+ if(!item) return '';
+ var data = this.grid.store.getValue(item , 'ordering_agency')
+ return fieldmapper.aou.findOrgUnit(data).shortname();
}
-function getProvider(rowIndex) {
- data = poGrid.model.getRow(rowIndex);
- if(!data) return;
- return openils.acq.Provider.retrieve(data.provider).code();
+function getProvider(rowIndex, item) {
+ if(!item) return '';
+ var data = this.grid.store.getValue(item, 'provider');
+ return openils.acq.Provider.retrieve(data).code();
}
-function getPOOwner(rowIndex) {
- data = poGrid.model.getRow(rowIndex);
- if(!data) return;
- return new openils.User({id:data.owner}).user.usrname();
+function getPOOwner(rowIndex, item) {
+ if(!item) return '';
+ var data = this.grid.store.getValue(item, 'owner');
+ return new openils.User({id:data}).user.usrname();
}
-function getDateTimeField(rowIndex) {
- data = poGrid.model.getRow(rowIndex);
- if(!data) return;
- var date = dojo.date.stamp.fromISOString(data[this.field]);
+function getDateTimeField(rowIndex, item) {
+ if(!item) return '';
+ var data = this.grid.store.getValue(item, this.field);
+ var date = dojo.date.stamp.fromISOString(data);
return dojo.date.locale.format(date, {formatLength:'medium'});
}
function loadPOGrid() {
- if(!PO) return;
+ if(!PO) return '';
var store = new dojo.data.ItemFileReadStore({data:acqpo.toStoreData([PO])});
- var model = new dojox.grid.data.DojoData(
- null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}});
- poGrid.setModel(model);
- poGrid.update();
+ poGrid.setStore(store);
+ poGrid.render();
}
function loadLIGrid() {
@@ -56,8 +55,6 @@
function load(po) {
lineitems = po.lineitems();
var store = new dojo.data.ItemFileReadStore({data:jub.toStoreData(lineitems)});
- var model = new dojox.grid.data.DojoData(
- null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}});
JUBGrid.populate(liGrid, model, lineitems)
}
Modified: trunk/Open-ILS/web/templates/default/acq/po/view.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/po/view.tt2 2008-12-11 16:07:10 UTC (rev 11519)
+++ trunk/Open-ILS/web/templates/default/acq/po/view.tt2 2008-12-11 16:07:12 UTC (rev 11520)
@@ -14,27 +14,31 @@
<div dojoType="dijit.layout.ContentPane" class='oils-acq-detail-content-pane' title="Summary" selected='true'>
<script type='dojo/connect' event='onShow'>loadPOGrid();</script>
- <script>
- var poGridStructure = [{
- cells : [[
- {name: 'ID', field: 'id'},
- {name: 'Owner', get:getPOOwner},
- {name: 'Ordering Agency', get:getOrgInfo},
- {name: 'Create Time', field:'create_time', width:'auto', get:getDateTimeField},
- {name: 'Edit Time', field: "edit_time", width:'auto', get:getDateTimeField},
- {name: 'Provider', get:getProvider},
- {name: '# Lineitems', field: 'lineitem_count'},
- {name: 'State', field:'state'}
- ]]
- }];
- </script>
- <div jsId='poGrid' dojoType="dojox.Grid" structure='poGridStructure'> </div>
+
+ <div dojoType="dijit.layout.ContentPane" layoutAlign="top">
+ <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'>
+ <table jsId="poGrid" dojoType="dojox.grid.DataGrid" query="{id: '*'}" rowSelector='20px'>
+ <thead>
+ <tr>
+ <th field="id">ID</th>
+ <th field="owner" get='getPOOwner'>Owner</th>
+ <th field="ordering_agency" get='getOrgInfo'>Ordering Agency</th>
+ <th field="create_time" width='auto' get='getDateTimeField'>Create Time</th>
+ <th field="edit_time" width='auto' get='getDateTimeField'>Edit Time</th>
+ <th field="provider" get='getProvider'>Provider</th>
+ <th field="lineitem_count"># Lineitems</th>
+ <th field="state">State</th>
+ </tr>
+ </thead>
+ </table>
+ </div>
+ </div>
+
+ <div dojoType="dijit.layout.ContentPane" class='oils-acq-detail-content-pane' title="Line Items">
+ <script type='dojo/connect' event='onShow'>loadLIGrid();</script>
+ [% grid_jsid = 'liGrid'; domprefix = 'oils-acq-lineitem' %]
+ [% INCLUDE 'default/acq/common/jubgrid.tt2' %]
+ </div>
</div>
- <div dojoType="dijit.layout.ContentPane" class='oils-acq-detail-content-pane' title="Line Items">
- <script type='dojo/connect' event='onShow'>loadLIGrid();</script>
- [% grid_jsid = 'liGrid'; domprefix = 'oils-acq-lineitem' %]
- [% INCLUDE 'default/acq/common/jubgrid.tt2' %]
- </div>
</div>
-</div>
-[% END %]
+ [% END %]
More information about the open-ils-commits
mailing list