ExtJS 4. Hidden treepanel with autoload false

不打扰是莪最后的温柔 提交于 2019-12-13 05:21:19

问题


I have a treepanel inside my form. The code is

{
xtype:'treepanel',
rootVisible:false,
hidden:true,
autoload:false,
store:{autoload:false,proxy:{type:'ajax',url:'../json/objectList.php?id='+id},root:{text:'Objects',id:'src',expanded:true}},
listeners:{
    show:function(){
        this.store.load();
    }
}
}

The problem is, I want to prevent loading before the tree is shown. But setting autoload to false does not have any effect. I still see a server request, even if the tree is hidden.


回答1:


The autoLoad property does not work for tree stores as the load is based on the expansion of the node as you are doing for root. This is what I do to overcome it.

In your store confing

root:{
    text:'Objects',
    id:'src',
    expanded:true,
    children:[]
}

Setting an empty children object will prevent the store load. Then all you need to do is set up a listener on the tree view to load the store as you have done. You will need to modify the server code to return the data without the children property...so just the array.



来源:https://stackoverflow.com/questions/18059699/extjs-4-hidden-treepanel-with-autoload-false

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