gpt4 book ai didi

javascript - 加载 extjs radiogroup 数据时出现问题

转载 作者:行者123 更新时间:2023-11-29 10:54:53 25 4
gpt4 key购买 nike

如何在 extjs 中为 radio 组加载数据,以便检查正确的 radio ?

关于 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 最近发布了。此外,您需要将单个 radio 项目的名称设置为组本身:

{
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 4, radio 组设置的以下结构对我来说是成功的:

{ "data" : 
[
{ "id" : "RadioGroupName",
"value" :
{ "RadioGroupName" : "inputValue" }
},
{ "id" : "RadioGroupName2",
"value" :
{ "RadioGroupName2" : "inputValue" }
}
],
"success" : true
}

关于javascript - 加载 extjs radiogroup 数据时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1961570/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com