</div>
<div id='vl-queue-div' style='display:none;height:100%;'>
<h1>Record Queue</h1><br/>
+ <script>
+ var vlQueueGridLayout = [{
+ cells : [[
+ { name: 'Selected',
+ get: vlQueueGridDrawSelectBox,
+ }
+ ]]
+ }];
+ </script>
+ <button dojoType='dijit.form.Button' onclick='vlSelectAllGridRecords'>Select All</button>
+ <button dojoType='dijit.form.Button' onclick='vlSelectNoGridRecords'>Select None</button>
+ <button dojoType='dijit.form.Button' onclick='vlImportSelectedRecords'>Import Selected</button>
<div style='height:100%;'>
<div dojoType='dojox.Grid' jsId='vlQueueGrid'> </div>
</div>
function buildRecordGrid(type) {
displayGlobalDiv('vl-queue-div');
- /* test structure... */
- var structure = [{
- //noscroll : true,
- cells : [[
- //{name: 'ID', field: 'id'},
- ]]
- }];
-
var defs = (type == 'bib') ? bibAttrDefs : authAttrDefs;
for(var i = 0; i < defs.length; i++) {
var attr = defs[i]
get: getAttrValue
};
if(attr.code().match(/title/i)) col.width = 'auto'; // this is hack.
- structure[0].cells[0].push(col);
+ vlQueueGridLayout[0].cells[0].push(col);
}
- vlQueueGrid.setStructure(structure);
+ vlQueueGrid.setStructure(vlQueueGridLayout);
var storeData;
if(type == 'bib')
var store = new dojo.data.ItemFileReadStore({data:storeData});
var model = new dojox.grid.data.DojoData(
null, store, {rowsPerPage: 100, clientSort: true, query:{id:'*'}});
+
vlQueueGrid.setModel(model);
vlQueueGrid.update();
}
+var selectableGridRecords = {};
+function vlQueueGridDrawSelectBox(rowIdx) {
+ var data = this.grid.model.getRow(rowIdx);
+ if(!data) return '';
+ var domId = 'vl-record-list-selected-' +data.id;
+ selectableGridRecords[domId] = data.id;
+ return "<input type='checkbox' id='"+domId+"'/>";
+}
+
+function vlSelectAllGridRecords() {
+ for(var id in selectableGridRecords)
+ dojo.byId(id).checked = true;
+}
+function vlSelectNoGridRecords() {
+ for(var id in selectableGridRecords)
+ dojo.byId(id).checked = false;
+}
+
+function vlImportSelectedRecords() {
+ for(var id in selectableGridRecords) {
+ if(dojo.byId(id).checked) {
+ var recId = selectableGridRecords[id];
+ alert(recId);
+ }
+ }
+}
+
var handleRetrieveRecords = function() {
buildRecordGrid(currentType);
}