关于Ext的Combo加载数据的问题。

 

  在combo的配置选项中有个mode,我们可以配置两个参数,local,remote 从字面意思上看,一个是本地加载,一个是远程加载。
    于是就出现了一个问题,我用jsonStore去后台取数据的时候,认为数据是从后台来的所以设置mode为remote,但是combo并没有显示数据出来,从fireBug看到我拿到了正确的数据。试了很久都没解决,后来看到自己代码的store是这样的。

var store = new Ext.data.JsonStore({
      url:'getClientNameList.action',
      root:'root',
      autoLoad:true,
      fields : [{name:'text'},{name:'value'}]
  }); 

     突然蹦出个想法,会不会是数据已经取回本地了(注意autoLoad:true,)于是改动mode:'local' ,测试成功。于是想是不是自己想错了, mode 的方式remote 和 local是字面上的意思那样么,发现文档是这样写的:
Acceptable values are: 'remote' : Default Automatically loads the store the first time the trigger is clicked. If you do not want the store to be automatically loaded the first time the trigger is clicked, set to 'local' and manually load the store. To force a requery of the store every time the trigger is clicked see lastQuery. 'local' : ComboBox loads local data
    意思大概是说,combo在第一次点击下拉按钮的时候会自动的load store ,竟然是这样为什么我设置成remote的时候点击下拉不会加载呢?
    于是怀疑是不要吧autoLoad:true去掉,因为觉得既然combo把你load了就不需要了,后面发现想错了autoLoad去掉默认也是true,应该是写为false,

总结
     …………………………………………………………………………

参考地址:http://www.verydemo.com/demo_c113_i14001.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值