Ext JS 3: How to copy a dynamically-generated treepanel?

时光总嘲笑我的痴心妄想 提交于 2019-12-11 04:40:04

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!