on line 27 of flattener_test.tt2 ... wth-subclass
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Mon, 26 Mar 2012 18:14:53 +0000 (14:14 -0400)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Mon, 26 Mar 2012 18:19:47 +0000 (14:19 -0400)
on line 27 of flattener_test.tt2 is the dojoType attribute on a table

If you make the value "dojox.grid.DataGrid", you see a grid and
everything works fine.

If you make the value "openils.widget.FlattenerGrid", which in this
example is like a do-nothing-different subclass, you can tell from
the debugging console that the grid dijit is somewhat built, but the
grid never displays.

wth!?!?

Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/src/templates/conify/flattener_test.tt2 [new file with mode: 0644]
Open-ILS/web/js/dojo/openils/widget/FlattenerGrid.js [new file with mode: 0644]

diff --git a/Open-ILS/src/templates/conify/flattener_test.tt2 b/Open-ILS/src/templates/conify/flattener_test.tt2
new file mode 100644 (file)
index 0000000..e2fd762
--- /dev/null
@@ -0,0 +1,41 @@
+[% WRAPPER base.tt2 %]
+[% ctx.page_title = 'Flattener Test' %]
+<script type="text/javascript">
+    dojo.require("dijit.form.Button");
+    dojo.require("openils.widget.FlattenerGrid");
+    dojo.require("dojo.data.ItemFileReadStore");
+
+    var gridData = {
+        "data":{
+            "identifier":"part_num",
+            "label":"part_num",
+            "items":[
+                {"part_num":7,"min_temp":0,"max_temp":32,"type":"ice","thick":5},
+                {"part_num":8,"min_temp":-10,"max_temp":22,"type":"ice_1","thick":6},
+                {"part_num":9,"min_temp":-20,"max_temp":12,"type":"ice_2","thick":7},
+            ]
+        }
+    };
+
+    var gridStore = new dojo.data.ItemFileReadStore(gridData);
+
+    console.log("gridStore built");
+
+</script>
+<table
+    id="gridNode"
+    jsid="grid"
+    dojoType="dojox.grid.DataGrid"
+    autoHeight="10"
+    query="{part_num: '*'}" store="gridStore">
+    <thead>
+        <tr>
+            <th field="part_num">Part Number</th>
+            <th field="min_temp" width="100px">Minimum Temperature</th>
+            <th field="max_temp" width="100px">Maximum Temperature</th>
+            <th field="type" width="100px">Type</th>
+            <th field="thick" width="5em">Thickness</th>
+        </tr>
+    </thead>
+</table>
+[% END %]
diff --git a/Open-ILS/web/js/dojo/openils/widget/FlattenerGrid.js b/Open-ILS/web/js/dojo/openils/widget/FlattenerGrid.js
new file mode 100644 (file)
index 0000000..96d2963
--- /dev/null
@@ -0,0 +1,11 @@
+if (!dojo._hasResource["openils.widget.FlatGrid"]) {
+    dojo.provide("openils.widget.FlattenerGrid");
+
+    dojo.require("dojox.grid.DataGrid");
+
+    dojo.declare(
+        "openils.widget.FlattenerGrid",
+        [dojox.grid.DataGrid], {
+        }
+    );
+}