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');
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 getSubfield(rowIdx) {
- data = padGrid.model.getRow(rowIdx);
- if(!data) return;
- return data.xpath.replace(marcRegex, '$2');
+function getTag(rowIdx, item) {
+ if(!item) return '';
+ var xpath = this.grid.store.getValue(item, 'xpath');
+ return xpath.replace(marcRegex, '$1');
}
+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() {
<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;'>
</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>
</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 %]