동적 데이터 생성 Ext Checkbox Group 및 Checkbox 값 코드

1872 단어 ext
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({
				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();

}

좋은 웹페이지 즐겨찾기