【发布时间】:2013-10-03 15:25:30
【问题描述】:
我是extjs的新手(使用ext.js 4.1),我还在学习它,但是我现在要做的事情有点棘手,我想请教有经验的人开发商。问题在于这些按钮:
{
xtype : 'checkboxgroup',
store : checked,
columns : 3,
vertical : false,
singleSelect: true,
items : [
{
xtype: 'button',
text: 'name',
width: 75,
toggleGroup: 'mygroup',
enableToggle: true
}, {
xtype: 'button',
text: 'email',
width:75,
toggleGroup: 'mygroup',
enableToggle: true
}, {
xtype: 'button',
text: 'id',
width: 75,
toggleGroup: 'mygroup',
enableToggle: true
}
],
listeners :
{
'change' :
// store checked field
function(th, newValue, oldValue) {
var ics = th.items.items;
for (i = 0; i < 3; i++) {
checked[i] = ics[i].checked;
}
}
}
}
正如您所看到的,有一个监听器,当按钮只是复选框时它正在工作(我现在将它们更改为一次只检查一个)。现在我假设我必须将侦听器更改为更多侦听器,每个按钮一个。但问题是:
如何从按钮中获取值?
监听器的函数在函数的参数层面应该如何构造?
我将不得不更改过滤商店的“已检查”变量...
我正在从this 复制答案,但它仍然无法正常工作。它不注册事件。
【问题讨论】: