[open-ils-commits] r11508 - 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 10:51:53 EST 2008
Author: erickson
Date: 2008-12-11 10:51:51 -0500 (Thu, 11 Dec 2008)
New Revision: 11508
Modified:
trunk/Open-ILS/web/js/ui/default/acq/po/search.js
trunk/Open-ILS/web/templates/default/acq/po/search.tt2
Log:
move to markup grid
Modified: trunk/Open-ILS/web/js/ui/default/acq/po/search.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/po/search.js 2008-12-11 15:40:35 UTC (rev 11507)
+++ trunk/Open-ILS/web/js/ui/default/acq/po/search.js 2008-12-11 15:51:51 UTC (rev 11508)
@@ -2,7 +2,7 @@
dojo.require('dijit.form.Button');
dojo.require('dijit.form.FilteringSelect');
dojo.require('dijit.form.NumberTextBox');
-dojo.require('dojox.grid.Grid');
+dojo.require('dojox.grid.DataGrid');
dojo.require('openils.acq.Provider');
dojo.require('fieldmapper.OrgUtils');
dojo.require('dojo.date.locale');
@@ -11,28 +11,29 @@
dojo.require('openils.Util');
dojo.require('openils.widget.OrgUnitFilteringSelect');
-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).name();
+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'});
}
@@ -55,10 +56,8 @@
oncomplete : function(r) {
dojo.style('po-grid', 'visibility', 'visible');
var store = new dojo.data.ItemFileReadStore({data:acqpo.toStoreData(itemList)});
- 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();
},
}
);
Modified: trunk/Open-ILS/web/templates/default/acq/po/search.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/po/search.tt2 2008-12-11 15:40:35 UTC (rev 11507)
+++ trunk/Open-ILS/web/templates/default/acq/po/search.tt2 2008-12-11 15:51:51 UTC (rev 11508)
@@ -7,10 +7,10 @@
<script src='[% ctx.media_prefix %]/js/ui/default/acq/po/search.js'> </script>
<script>
- function getId(rowIndex) {
- data = poGrid.model.getRow(rowIndex);
- if(!data) return;
- return '<a href="[% ctx.base_uri %]/acq/po/view/' + data.id + '">'+data.id;
+ function getId(rowIndex, item) {
+ if(!item) return;
+ var data = this.grid.store.getValue(item, 'id');
+ return '<a href="[% ctx.base_uri %]/acq/po/view/' + data + '">'+data;
}
</script>
@@ -33,7 +33,7 @@
<tr>
<td><label for='provider'>Provider</label></td>
<td><select labelAttr='code' searchAttr='code' name='provider'
- style='overflow-y:auto;' jsId="providerSelector" dojoType="dijit.form.FilteringSelect"> </select></td>
+ style='overflow-y:auto;' jsId="providerSelector" dojoType="dijit.form.FilteringSelect"> </select></td>
</tr>
<tr>
<td><label for='state'>State</label></td>
@@ -56,21 +56,24 @@
</tr>
</table>
</form>
+<div dojoType="dijit.layout.ContentPane" layoutAlign="top">
+ <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'>
+ <table id="po-grid" jsId="poGrid" dojoType="dojox.grid.DataGrid" query="{id: '*'}" rowSelector='20px'>
+ <thead>
+ <tr>
+ <th field="id" get='getId'>ID</th>
+ <th field="owner" get='getPOOwner'>Owner</th>
+ <th field="ordering_agency" get='getOrgInfo'>Ordering Agency</th>
+ <th field="create_time" get='getDateTimeField' width='auto'>Create Time</th>
+ <th field="edit_time" get='getDateTimeField' width ='auto'>Edit Time</th>
+ <th field="provider" get='getProvider' width='auto'>Provider</th>
+ <th field="state">State</th>
+ </tr>
+ </thead>
+ </table>
+ </div>
+</div>
-<script>
- var poGridStructure = [{
- cells : [[
- {name: 'ID', field: 'id', get:getId},
- {name: 'Owner', get:getPOOwner},
- {name: 'Ordering Agency', get:getOrgInfo},
- {name: 'Create Time', field:'create_time', get:getDateTimeField, width:'auto'},
- {name: 'Edit Time', field: "edit_time", get:getDateTimeField, width:'auto'},
- {name: 'Provider', get:getProvider, width:'auto'},
- {name: 'State', field:'state'}
- ]]
- }];
-</script>
-<div jsId='poGrid' id='po-grid' dojoType="dojox.Grid" structure='poGridStructure'></div>
<script>dojo.style('po-grid', 'visibility', 'hidden');</script>
[% END %]
More information about the open-ils-commits
mailing list