1

I have a dynamically-generated Ext.tree.TreePanel in Ext 3.3.1. It looks like this:

-root
    -fruit
        -apple
    -vegetable
        -carrot

I need to make a duplicate/copy of this tree. I understand that the ids will be different and that's fine, but I want the text and the structure to be the same.

My current idea is to recursively go through and node-by-node create a new tree. Is there a faster way? NOTE: Someone very helpfully suggested cloneConfig(), but my understanding is that it will not capture a dynamically-generated tree. Is this confusion on my part?

Thanks for your time.

Miriam
  • 969
  • 1
  • 6
  • 15

1 Answers1

2

You can make a clone of any ExtJS component's configuration using cloneConfig() function.

See the Ext.Component documentation: http://docs.sencha.com/ext-js/3-4/#!/api/Ext.Component-method-cloneConfig

blong
  • 2,815
  • 8
  • 44
  • 110
Xupypr MV
  • 935
  • 10
  • 18
  • Thank you - this answers the question I asked but unfortunately not the one I meant. I have a **dynamically generated** tree. To be fair, I'll give you credit for answering but keep the question open. – Miriam Aug 02 '11 at 12:11
  • Why not? You can clone your store not only tree. Or explain what you mean in "dynamically-generated". – Xupypr MV Aug 02 '11 at 12:18
  • In Ext 3, trees don't have stores. My tree is dynamically generated by recursive calls to a web service. I'm trying to clone its current state rather than having to re-do all those calls. – Miriam Aug 02 '11 at 20:32
  • Add your code please. May be we can clone only root, otherwise we can clone all tre recursively. – Xupypr MV Aug 02 '11 at 21:35
  • I'm sorry, I can't add my code, I'm working for a private company. – Miriam Aug 05 '11 at 18:10