From: erickson Date: Tue, 5 May 2009 20:47:21 +0000 (+0000) Subject: ported the attr def grid to the newer dojox.grid.DataGrid, plus some other dojo api... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=92881dcba625a77de4664438e0c902d113ff3436;p=evergreen%2Fbjwebb.git ported the attr def grid to the newer dojox.grid.DataGrid, plus some other dojo api fixes. 2 grids to go git-svn-id: svn://svn.open-ils.org/ILS/trunk@13083 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/vandelay/inc/attrs.xml b/Open-ILS/web/vandelay/inc/attrs.xml index c65744b56..03a49f93f 100644 --- a/Open-ILS/web/vandelay/inc/attrs.xml +++ b/Open-ILS/web/vandelay/inc/attrs.xml @@ -81,22 +81,21 @@ - -
-
+
+ + + + + + + + + + + + + +
&vandelay.id;&vandelay.code;&vandelay.descrip;&vandelay.tag;&vandelay.subfield;&vandelay.identifier;&vandelay.xpath;&vandelay.remove;
diff --git a/Open-ILS/web/vandelay/vandelay.css b/Open-ILS/web/vandelay/vandelay.css index b619aad69..8296037a7 100644 --- a/Open-ILS/web/vandelay/vandelay.css +++ b/Open-ILS/web/vandelay/vandelay.css @@ -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"; +@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; } diff --git a/Open-ILS/web/vandelay/vandelay.js b/Open-ILS/web/vandelay/vandelay.js index af9699985..44864098d 100644 --- a/Open-ILS/web/vandelay/vandelay.js +++ b/Open-ILS/web/vandelay/vandelay.js @@ -27,6 +27,7 @@ dojo.require('dijit.Menu'); 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 onAttrEditorClose() { 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(); diff --git a/Open-ILS/web/vandelay/vandelay.xml b/Open-ILS/web/vandelay/vandelay.xml index 10aac2457..15307491a 100644 --- a/Open-ILS/web/vandelay/vandelay.xml +++ b/Open-ILS/web/vandelay/vandelay.xml @@ -22,7 +22,7 @@ &vandelay.vandelay; - +