我正在尝试使用事件委托将我在 Sencha 中检查的复选框的标签添加到商店。
如何将复选框的标签作为参数传递?我在代表团中做得好吗?我有一个类似“意外令牌”的错误。
我真的必须把函数分开,因为我想写 30 个复选框,并且每个人都在检查时具有相同的侦听器。
非常感谢你。
//this chekbox code
{
xtype: 'checkboxfield',
label: 'Noir',
listeners: {
check: anadir(label)
}
}
//This check function code
anadir: function(label) {
console.log("Añadiendo...");
var index = storemisOpciones.getCount() - 1;
console.log("Indice: " + index);
storemisOpciones.add({
option: label
});
console.log(label + " se ha marcado");
index = storemisOpciones.getCount() - 1;
console.log("Indice: " + index);
console.log(storemisOpciones.getAt(index));
storemisOpciones.sync();
}