Opened 10 years ago
Closed 10 years ago
#12204 closed defect (fixed)
[regression] Problem of defining source html table of HtmlStore in the TitlePane
Reported by: | tbbt | Owned by: | bill |
---|---|---|---|
Priority: | high | Milestone: | 1.6 |
Component: | DojoX Data | Version: | 1.6.0b1 |
Keywords: | HtmlStore TitlePane | Cc: | |
Blocked By: | Blocking: |
Description (last modified by )
When defining a source html table of HtmlStore in the TitlePane,the DataGrid fed by such HtmlStore will not be shown. The source code is as following:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <style type="text/css"> @import "dojoroot/dijit/themes/claro/claro.css"; @import "dojoroot/dojo/resources/dojo.css" @import "dojoroot/dojox/grid/resources/Grid.css"; @import "dojoroot/dojox/grid/resources/claroGrid.css"; .grid { width: 50%; height: 100%; padding: 1px; border: solid 1px black; border-style:outset; } </style> <script type="text/javascript" src="dojoroot/dojo/dojo.js" djConfig="parseOnLoad: true"> </script> <script type="text/javascript"> dojo.require("dojo.parser"); dojo.require("dojox.data.HtmlStore"); dojo.require("dojox.grid.DataGrid"); dojo.require("dijit.TitlePane"); var unitInfoLayout = [[ { field : "UnitType", name : "Unit Type", width: "40%" , headerStyles : "text-align: center" }, { field : "UnitFamily", name : "Unit Family", width : "35%", headerStyles : "text-align: center" }, { field : "Amount", name : "Amount", width : "25%" , headerStyles : "text-align: center" } ]]; </script> </head> <body class="claro"> <div dojoType="dijit.TitlePane" title="Unit Info Table" style="margin: 5px"> <table id="unitInfoSrcTable" style="display:none"> <thead> <tr><th>UnitType</th> <th>UnitFamily</th> <th>Amount</th></tr> </thead> <tbody> <tr> <td>10G-TRP-6350</td> <td>6300</td> <td>1</td> </tr> <tr> <td>Total</td> <td>-</td> <td>16277</td> </tr> </tbody> </table> <div dojoType="dojox.data.HtmlStore" jsId="unitInfoStore" dataId="unitInfoSrcTable" > </div> <table id="unitCountGrid" class="grid" dojoType="dojox.grid.DataGrid" store="unitInfoStore" structure="unitInfoLayout" query="{}" autoHeight="true" rowsPerPage="25" > </table> </div> </body> </html>
The code has worked in previous releases.
Change History (5)
comment:1 Changed 10 years ago by
Description: | modified (diff) |
---|---|
Summary: | Problem of defining source html table of HtmlStore in the TitlePane → [regression] Problem of defining source html table of HtmlStore in the TitlePane |
comment:2 Changed 10 years ago by
comment:3 Changed 10 years ago by
Component: | General → Dijit |
---|---|
Milestone: | tbd → 1.6 |
Owner: | anonymous deleted |
Hmm, well I see what's going on but it's not easy to fix.
The <table> node has been moved inside of the TitlePane.containerNode. But, the TitlePane.domNode hasn't been attached to the document yet. So, HtmlStore is calling dojo.byId(args.dataId)
with unfortunate timing, and it isn't finding the <table>
Dijit has a rule that widgets shouldn't assume they are attached to the DOM, nor that other sibling/parent/child widgets exist, until the startup() call, but changing that in HtmlStore might break other apps if they aren't calling HtmlStore.startup(). Plus which, it complicates the API.
One workaround is to put the <table> node outside of the TitlePane. Could also put the HtmlStore outside the TitlePane.
comment:4 Changed 10 years ago by
Component: | Dijit → DojoX Data |
---|---|
Owner: | set to bill |
Status: | new → assigned |
OK, HTMLStore, like ItemFileReadStore, has code to defer loading until the first fetch. It just doesn't quite work right. I'll fix it.
comment:5 Changed 10 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
(In [23654]) Removed call to _indexItems() in the constructor. The rest of the code was designed to defer loading data until the first fetch call and this was interfering.
Don't set store variable on each row DOMNode, pointing back to the javascript Object. This is the cardinal sin causing memory leaks on IE, due to circular references.
Fixes #12204 !strict.
Just to clarify, from what little I was able to gather:
This code works in Dojo 1.5 (also tried 1.4 and 1.3.2 using Tundra, fine there too). It dies in 1.6 because the contents of the TitlePane's srcNodeRef appear to have been wiped out before they get parsed - which means that at the time the HtmlStore gets instantiated, the table no longer exists.
I'm thinking the regression may be due to either parser or ContentPane changes but I haven't been able to put my finger on it.
FWIW, this is easily worked around simply by moving the table that is the source of the HtmlStore's data, outside the TitlePane, but the point remains that this used to work and now doesn't, and is thus a regression.