问题
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.
回答1:
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
来源:https://stackoverflow.com/questions/6903621/ext-js-3-how-to-copy-a-dynamically-generated-treepanel