[open-ils-commits] r13083 - in trunk/Open-ILS/web/vandelay: . inc (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue May 5 16:47:25 EDT 2009
Author: erickson
Date: 2009-05-05 16:47:21 -0400 (Tue, 05 May 2009)
New Revision: 13083
Modified:
trunk/Open-ILS/web/vandelay/inc/attrs.xml
trunk/Open-ILS/web/vandelay/vandelay.css
trunk/Open-ILS/web/vandelay/vandelay.js
trunk/Open-ILS/web/vandelay/vandelay.xml
Log:
ported the attr def grid to the newer dojox.grid.DataGrid, plus some other dojo api fixes. 2 grids to go
Modified: trunk/Open-ILS/web/vandelay/inc/attrs.xml
===================================================================
--- trunk/Open-ILS/web/vandelay/inc/attrs.xml 2009-05-05 20:32:25 UTC (rev 13082)
+++ trunk/Open-ILS/web/vandelay/inc/attrs.xml 2009-05-05 20:47:21 UTC (rev 13083)
@@ -81,22 +81,21 @@
</table>
</div>
</div>
-<script>
- var vlAttrGridLayout = [{
- cells : [[
- {name: '&vandelay.id;', field: 'id'},
- {name: '&vandelay.code;', field:'code', width:'auto'},
- {name: '&vandelay.descrip;', field: "description", width:'auto'},
- {name: '&vandelay.tag;', get:attrGridGetTag},
- {name: '&vandelay.subfield;', get: attrGridGetSubfield},
- {name: '&vandelay.identifier;', field:'ident'},
- {name: '&vandelay.xpath;', field:'xpath', width:'auto'},
- {name: '&vandelay.remove;', field:'remove', width:'auto'}
- ]]
- }];
-</script>
-<div class='tall'>
- <div dojoType='dojox.Grid' jsId='attrEditorGrid'> </div>
+<div style='height:600px;'>
+ <table dojoType='dojox.grid.DataGrid' jsId='attrEditorGrid' query="{id: '*'}">
+ <thead>
+ <tr>
+ <th field='id'>&vandelay.id;</th>
+ <th field='code' width='auto'>&vandelay.code;</th>
+ <th field='description' width='auto'>&vandelay.descrip;</th>
+ <th field='tag' get='attrGridGetTag'>&vandelay.tag;</th>
+ <th field='subfield' get='attrGridGetSubfield'>&vandelay.subfield;</th>
+ <th field='ident'>&vandelay.identifier;</th>
+ <th field='xpath' width='auto'>&vandelay.xpath;</th>
+ <th field='remove' width='auto'>&vandelay.remove;</th>
+ </tr>
+ </thead>
+ </table>
</div>
Modified: trunk/Open-ILS/web/vandelay/vandelay.css
===================================================================
--- trunk/Open-ILS/web/vandelay/vandelay.css 2009-05-05 20:32:25 UTC (rev 13082)
+++ trunk/Open-ILS/web/vandelay/vandelay.css 2009-05-05 20:47:21 UTC (rev 13083)
@@ -1,6 +1,8 @@
@import "/js/dojo/dojo/resources/dojo.css";
@import "/js/dojo/dijit/themes/tundra/tundra.css";
@import "/js/dojo/dojox/grid/_grid/Grid.css";
+ at import "/js/dojo/dojox/grid/resources/tundraGrid.css";
+
.container:after {content: ""; display: block; height: 0; clear: both; }
html,body { width:100%; height:100%; border:0; margin:0; padding:0; background-color:white; }
table { border-collapse: collapse; }
Modified: trunk/Open-ILS/web/vandelay/vandelay.js
===================================================================
--- trunk/Open-ILS/web/vandelay/vandelay.js 2009-05-05 20:32:25 UTC (rev 13082)
+++ trunk/Open-ILS/web/vandelay/vandelay.js 2009-05-05 20:47:21 UTC (rev 13083)
@@ -27,6 +27,7 @@
dojo.require("dijit.Dialog");
dojo.require("dojo.cookie");
dojo.require("dojox.grid.Grid");
+dojo.require('dojox.grid.DataGrid');
dojo.require("dojo.data.ItemFileReadStore");
dojo.require('dojo.date.locale');
dojo.require('dojo.date.stamp');
@@ -974,42 +975,37 @@
function loadAttrEditorGrid() {
var _data = (ATTR_EDIT_GROUP == 'auth') ?
vqarad.toStoreData(authAttrDefs) : vqbrad.toStoreData(bibAttrDefs) ;
-
+
var store = new dojo.data.ItemFileReadStore({data:_data});
- var model = new dojox.grid.data.DojoData(
- null, store, {rowsPerPage: 100, clientSort: true, query:{id:'*'}});
- attrEditorGrid.setModel(model);
- attrEditorGrid.setStructure(vlAttrGridLayout);
- attrEditorGrid.onRowClick = onAttrEditorClick;
+ attrEditorGrid.setStore(store);
+ dojo.connect(attrEditorGrid, 'onRowClick', onAttrEditorClick);
attrEditorGrid.update();
}
-function attrGridGetTag(n) {
+function attrGridGetTag(n, item) {
// grid helper: return the tags from the row's xpath column.
- var xp = this.grid.model.getRow(n);
- return xp && xpathParser.parse(xp.xpath).tags;
+ return item && xpathParser.parse(this.grid.store.getValue(item, 'xpath')).tags;
}
-function attrGridGetSubfield(n) {
+function attrGridGetSubfield(n, item) {
// grid helper: return the subfields from the row's xpath column.
- var xp = this.grid.model.getRow(n);
- return xp && xpathParser.parse(xp.xpath).subfields;
+ return item && xpathParser.parse(this.grid.store.getValue(item, 'xpath')).subfields;
}
-function onAttrEditorClick(evt) {
- var row = attrEditorGrid.model.getRow(evt.rowIndex);
- ATTR_EDIT_ID = row.id;
+function onAttrEditorClick() {
+ var row = this.getItem(this.focus.rowIndex);
+ ATTR_EDIT_ID = this.store.getValue(row, 'id');
ATTR_EDITOR_IN_UPDATE_MODE = true;
// populate the popup editor.
- dojo.byId('attr-editor-code').value = row.code;
- dojo.byId('attr-editor-description').value = row.description;
- var parsed_xpath = xpathParser.parse(row.xpath);
- dojo.byId('attr-editor-tags').value = parsed_xpath.tags;
- dojo.byId('attr-editor-subfields').value = parsed_xpath.subfields;
- dojo.byId('attr-editor-identifier').value = (row.ident ? 'True':'False');
- dojo.byId('attr-editor-xpath').value = row.xpath;
- dojo.byId('attr-editor-remove').value = row.remove;
+ dijit.byId('attr-editor-code').attr('value', this.store.getValue(row, 'code'));
+ dijit.byId('attr-editor-description').attr('value', this.store.getValue(row, 'description'));
+ var parsed_xpath = xpathParser.parse(this.store.getValue(row, 'xpath'));
+ dijit.byId('attr-editor-tags').attr('value', parsed_xpath.tags);
+ dijit.byId('attr-editor-subfields').attr('value', parsed_xpath.subfields);
+ dijit.byId('attr-editor-identifier').attr('value', this.store.getValue(row, 'ident'));
+ dijit.byId('attr-editor-xpath').attr('value', this.store.getValue(row, 'xpath'));
+ dijit.byId('attr-editor-remove').attr('value', this.store.getValue(row, 'remove'));
// set up UI for editing
dojo.byId('vl-create-attr-editor-button').click();
Modified: trunk/Open-ILS/web/vandelay/vandelay.xml
===================================================================
--- trunk/Open-ILS/web/vandelay/vandelay.xml 2009-05-05 20:32:25 UTC (rev 13082)
+++ trunk/Open-ILS/web/vandelay/vandelay.xml 2009-05-05 20:47:21 UTC (rev 13083)
@@ -22,7 +22,7 @@
<head>
<title>&vandelay.vandelay;</title>
<link type='text/css' rel='stylesheet' href="/vandelay/vandelay.css"/>
- <script type="text/javascript" djConfig="parseOnLoad: true,isDebug:false" src="/js/dojo/dojo/dojo.js"></script>
+ <script type="text/javascript" djConfig="parseOnLoad: true,isDebug:true" src="/js/dojo/dojo/dojo.js"></script>
<script type="text/javascript" src='/js/dojo/openils/MarcXPathParser.js'></script>
<script type="text/javascript" src='/vandelay/vandelay.js'></script>
</head>
More information about the open-ils-commits
mailing list