ext js動態加載checkbox的值及取值方法

DoctorWorkStation_CommonDoctorAdvice.CreateYZCheckBoxWin = function(store, colnum,title) {
var count = store.getCount();
var myCheckboxItems = [];
for (var i = 0; i < count; i++) {
var boxLabel = store.getAt(i).get("name");
var name = store.getAt(i).get("id");
myCheckboxItems.push({
boxLabel : boxLabel,
name : name
});
}
var myCheckboxGroup = new Ext.form.CheckboxGroup({
xtype : 'checkboxgroup',
itemCls : 'x-check-group-alt',
columns : colnum,
items : myCheckboxItems
});
var form = new Ext.FormPanel({
border : true,
frame : true,
labelAlign : "right",
buttonAlign : 'right',
layout : 'column',
width : 500,
items : [myCheckboxGroup],
buttons : [{
xtype : 'button',
text : '確定',
handler : function() {
var ids = [];
var cbitems = myCheckboxGroup.items;
for (var i = 0; i < cbitems.length; i++) {
if (cbitems.itemAt(i).checked) {
ids.push(cbitems.itemAt(i).name);
}
}
win.destroy();
if (ids.length) {
Ext.Msg.alert("消息", "選中狀態的id組合字符串爲:"
+ ids.toString());
}
}

}, {
xtype : 'button',
text : '取消',
handler : function() {
win.destroy();
}

}]

});
var win = new Ext.Window({
modal : true,
layout : 'fit',
title : title,
width : 500,
height : 300,
plain : true,
items : [form]
});
win.show();

}
發佈了25 篇原創文章 · 獲贊 0 · 訪問量 929
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章