Closed
Bug 663728
Opened 13 years ago
Closed 13 years ago
XUL tree twisty state won't persist if XML template is used
Categories
(Core :: XUL, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: bhovhannes, Assigned: enndeakin)
Details
(Keywords: dev-doc-complete)
Attachments
(3 files)
User-Agent: Opera/9.80 (Windows NT 6.1; U; en) Presto/2.8.131 Version/11.11
Build Identifier: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
I've an XUL tree element with querytype="xml" attribute set. Tree element is populated from XML datasource. Datasource has the following format:
<items>
<item name="A" id="1">
<item name="A child 1" id="2"/>
<item name="A child 1" id="3"/>
</item>
<item name="B" id="4">
<item name="C" id="5">
<item name="C child 1" id="6"/>
</item>
</items>
The bug is that tree twisty state won't persist. For example, if I open items A and C using twisty button, they won't stay open after window reload.
For comparison. If RDF datasource is used and "rdf:about"
attribute is present on items A and C, tree remembers twisty state
correctly, that is, if I open children of item A and then reload my
XUL window, item A remains opened.
Reproducible: Always
Steps to Reproduce:
1. Prepare XML datasource with nested levels, with "id" attributes for each item
2. Prepare XUL tree with template, which will generate nested treeitems if recursive datasource is attached
3. Attach XML datasource from step 1 to tree from step 2. Make sure, that tree has nested treeitems, which can be opened/closed using twisty button.
4. Open any treeitem to see its children
5. Reload window
Actual Results:
Opened treeitem appears closed after reloading window.
Expected Results:
Opened treeitem should stay opened after reloading window if "id" attribute is present in XML datasource
Such behavior was observed under both 32 and 64 bit Windows for all Firefox/XULRunner versions with XML datasource support.
Reporter | ||
Comment 1•13 years ago
|
||
Reporter | ||
Comment 2•13 years ago
|
||
Assignee | ||
Updated•13 years ago
|
Attachment #538782 -
Attachment mime type: application/octet-stream → application/vnd.mozilla.xul+xml
Assignee | ||
Updated•13 years ago
|
Attachment #538784 -
Attachment mime type: application/octet-stream → text/xml
Assignee | ||
Comment 3•13 years ago
|
||
This patch fixes this issue.
Two comments about the testcase that would need to be changed:
- an xml id needs to be declared in the xml source
- the patch only works for dont-build-content trees
Assignee: nobody → enndeakin
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Assignee | ||
Comment 4•13 years ago
|
||
Comment on attachment 538968 [details] [diff] [review]
fix
This patch generates the id from the source node's id, rather than using a random value. This way it is always the same each time so persistence can work.
Attachment #538968 -
Flags: review?(jonas)
Comment on attachment 538968 [details] [diff] [review]
fix
Is it documented somewhere how this stuff works? And that we're recommending that you put an id on the relevant elements?
Attachment #538968 -
Flags: review?(jonas) → review+
Keywords: dev-doc-needed
Assignee | ||
Comment 6•13 years ago
|
||
The idea is that the datasource nodes should have ids if you plan to you the persist feature with them. Persisting of open tree nodes is part of the tree builder, so ids are needed there. However, if you don't want or need persistence, then ids aren't necessary.
Sure, but we still need to document this somewhere other than
In this bug.
Assignee | ||
Comment 8•13 years ago
|
||
My comment 6 is intended to be a summary to be used by someone documenting this.
Assignee | ||
Comment 9•13 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Comment 10•13 years ago
|
||
Looking for suggestions on appropriate places to document this. Would this be one?
https://developer.mozilla.org/en/XUL/treeitem
Any other suggestions? This isn't an area of the docs I've done much with, so I want to be sure to get it right.
Assignee | ||
Comment 11•13 years ago
|
||
Comment 12•13 years ago
|
||
Added notes:
https://developer.mozilla.org/en/XUL/Template_Guide/Building_Trees#Using_Tree_Properties
https://developer.mozilla.org/en/XUL/Template_Guide/XML_Templates
And mentioned on Firefox 7 for developers.
Keywords: dev-doc-needed → dev-doc-complete
Reporter | ||
Comment 13•13 years ago
|
||
I've added flags="dont-build-content" to XUL tree in the example bug.xul attached above, but treeitem state still doesn't persist.
I am using Firefox 7
You need to log in
before you can comment on or make changes to this bug.
Description
•