moved grid layout into the markup for easier i18nization. added buttons to select...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 2 Sep 2008 17:30:27 +0000 (17:30 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 2 Sep 2008 17:30:27 +0000 (17:30 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@10508 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/vandelay/vandelay.html
Open-ILS/web/vandelay/vandelay.js

index ed982e8..1af6b15 100644 (file)
         </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>
index 48acd60..dfb5797 100644 (file)
@@ -211,14 +211,6 @@ function getAttrValue(rowIdx) {
 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]
@@ -229,10 +221,10 @@ function buildRecordGrid(type) {
             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')
@@ -243,10 +235,38 @@ function buildRecordGrid(type) {
     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);
 }