微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

javascript-加载extjs广播组数据时出现问题

如何在extjs中加载无线电组的数据,以便检查正确的无线电?

extjs radio/checkbox example page上,您将找到类似这样的代码

{
  xtype: 'radiogroup',
  fieldLabel: 'Auto Layout',
  items: [
       {BoxLabel: 'Item 1', name: 'rb-auto', inputValue: 1},
       {BoxLabel: 'Item 2', name: 'rb-auto', inputValue: 2, checked: true},
       {BoxLabel: 'Item 3', name: 'rb-auto', inputValue: 3},
       {BoxLabel: 'Item 4', name: 'rb-auto', inputValue: 4},
       {BoxLabel: 'Item 5', name: 'rb-auto', inputValue: 5}
   ]
 }

我希望做一个像{‘rb-auto’:3,…}这样的带有json的form.load()会将项目3标记为已选中.这行不通.
您怎么能达到这种效果

答:(Zach关于extjs 3.1是正确的)我的期望是正确的,但仅因为extjs 3.1是最近发布的.同样,您需要在单个广播项目上都将名称设置为组本身:

{
  xtype: 'radiogroup',
  fieldLabel: 'Auto Layout',
  name: 'rb-auto',
  items: [
       {BoxLabel: 'Item 1', name: 'rb-auto', inputValue: 1},
       {BoxLabel: 'Item 2', name: 'rb-auto', inputValue: 2, checked: true},
       {BoxLabel: 'Item 3', name: 'rb-auto', inputValue: 3},
       {BoxLabel: 'Item 4', name: 'rb-auto', inputValue: 4},
       {BoxLabel: 'Item 5', name: 'rb-auto', inputValue: 5}
   ]
 }

解决方法:

这是适用于extjs 3.0的解决方案:
http://www.extjs.com/forum/showthread.php?t=39161

对于3.1,它不起作用.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐