moved picklist grid to new-style (dojo 1.2) markup grid
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 9 Dec 2008 16:10:40 +0000 (16:10 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 9 Dec 2008 16:10:40 +0000 (16:10 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@11474 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/ui/default/acq/picklist/view_list.js
Open-ILS/web/templates/default/acq/picklist/list.tt2

index ca25741..93de401 100644 (file)
@@ -1,4 +1,4 @@
-dojo.require('dojox.grid.Grid');
+dojo.require('dojox.grid.DataGrid');
 dojo.require('dijit.Dialog');
 dojo.require('dijit.form.Button');
 dojo.require('dijit.form.TextBox');
@@ -11,10 +11,8 @@ var listAll = false;
 
 function makeGridFromList() {
     var store = new dojo.data.ItemFileReadStore({data:acqpl.toStoreData(plList)});
-    var model = new dojox.grid.data.DojoData(null, store, 
-        {rowsPerPage: 20, clientSort: true, query:{id:'*'}});
-    plListGrid.setModel(model);
-    plListGrid.update();
+    plListGrid.setStore(store);
+    plListGrid.render();
 }
 
 
index 5e8955d..4e6bff5 100644 (file)
 
 
 <script>
-    function getName(rowIndex) {
-        data = plListGrid.model.getRow(rowIndex);
-        if(!data) return;
-        return '<a href="[% ctx.base_uri %]/acq/picklist/view/'+data.id+'">'+data.name+'</a>';
+    function getName(rowIndex, item) {
+        if(!item) return '';
+        var name = this.grid.store.getValue(item, 'name');
+        var id = this.grid.store.getValue(item, 'id');
+        return '<a href="[% ctx.base_uri %]/acq/picklist/view/'+id+'">'+name+'</a>';
     }
-
-    var plListGridStructure = [{
-        cells : [[
-            {name: 'ID', field: 'id'},
-            {name: 'Name', width:'auto', get:getName}, 
-            {name: 'Selector', field:'owner'},
-            {name: 'Create Time', field: 'create_time'}, 
-            {name: 'Edit Time', field: 'edit_time'},
-            {name: 'Entry Count', field: 'entry_count'},
-        ]]
-    }];
 </script>
-<div jsId='plListGrid' dojoType="dojox.Grid" structure='plListGridStructure'></div>
+<div dojoType="dijit.layout.ContentPane" layoutAlign="top">
+    <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'>
+        <table jsId="plListGrid" dojoType="dojox.grid.DataGrid" query="{id: '*'}" rowSelector='20px'>
+            <thead>
+                <tr>
+                    <th field="id">ID</th>
+                    <th field="name" width='auto' get='getName'>Name</th>
+                    <th field="owner">Selector</th>
+                    <th field="create_time">Create Time</th>
+                    <th field="edit_time">Edit Time</th>
+                    <th field="entry_count">Entry Count</th>
+                </tr>
+            </thead>
+        </table>    
+    </div>
+</div>
+
 [% END %]