PDA

View Full Version : recycling trees



neongrau
10 Apr 2007, 6:51 AM
to save the woods :)) j/k

i have a few small ajaxed trees in my application.
when the user selects a tree to display i create a new Ext.tree.TreePanel instance for it but they currently all share the save div-element for displaying.

to save a couple of ajaxed round-trips i just clear the innerHTML of that div and call tree.render() again to allow fast switching between the trees.
this seems to work nicely with FF, but IE won't render it again :((


is this a bug, or is this generally a bad idea? what would be the best way to achieve that behavior? one div for each tree and show/hide the divs?

neongrau
10 Apr 2007, 7:13 AM
or more precisely

all IE renders is this:

<DIV class=x-tree-root-node>
<LI class=x-tree-node></LI>
<LI class=x-tree-node></LI>
<LI class=x-tree-node></LI>
<LI class=x-tree-node></LI>
<LI class=x-tree-node></LI></DIV>

jack.slocum
10 Apr 2007, 11:49 AM
I would reuse the same tree instance (if possible) otherwise you will need to replace the container element. There are too many bound listeners.

Eventually there will be a destroy method, it is on the list.