我被困在一种情况,在这种情况下,我必须'检查'位于工具栏中的复选框'检查'列表中存在的所有复选框。如何'检查'列表中的所有复选框'检查'单个复选框?
这里的代码来创建复选框列表: -
itemTpl: '<input type="checkbox" name="box" enabled="enabled" value="open"
name="comment_status" id="status" <tpl if="active">checked="checked"</tpl> />
{groupName}{#}',
这里是我的复选框代码: -
var checkBox = {
xtype: 'checkboxfield',
name : 'all',
// label: 'All',
itemId: 'all',
value: 'all',
lableWidth: "0",
width: 1,
padding: '0 0 15 30',
checked: false,
listeners: {
check:function() {
// alert("check");
item = Ext.get("status");
console.log("item:-"+Ext.JSON.encode(item));
chkBox = item.down('input').dom;
var checkboxes = Ext.getStore('group');
console.log(checkboxes.getCount());
for(var i=0;i<checkboxes.getCount();i++){
chkBox.checked = true;
}
},
uncheck:function(){
// alert("uncheck");
}
}
};
在上述复选框检查,我想,在“itemTpl”中定义的所有复选框会检查,反之亦然。我知道我的代码在检查:function(){}是没有那么好,解决了我的问题(两个代码在不同的意见)。
所以,请告诉我一些这个问题的解决方案。
Thanx提前。
您有与您的复选框相关的模型吗? – Sephy
是的,复选框列表有模型... – himanshu
好吧,在任何情况下,你必须遍历你的列表存储,更改每个项目对应于复选框的布尔值为true,你应该完成。 – Sephy