ExtJS 4.隐藏的treepanel与自动加载错误 [英] ExtJS 4. Hidden treepanel with autoload false

查看:208
本文介绍了ExtJS 4.隐藏的treepanel与自动加载错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的表格里面有一个treepanel。代码是

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

问题是,我想以防止在树显示之前加载。但是将autoload设置为false没有任何效果。我仍然看到一个服务器请求,即使该树被隐藏。

解决方案

autoLoad属性不适用于树存储负载基于节点的扩展,就像您在root中进行的那样。这是我要克服的。



在你的商店confing

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

设置一个空的子对象将阻止存储加载。然后,您需要做的就是在树视图上设置一个监听器,以便按照您的要求加载存储。您将需要修改服务器代码以返回没有子属性的数据...所以只需要数组。


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.

解决方案

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.

这篇关于ExtJS 4.隐藏的treepanel与自动加载错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆