日期:2014-05-16  浏览次数:20397 次

ExtJs CheckBoxGroup 更新所有子元素

function loadColumnPanel(combox) {
	jQuery.ajax({
		type : 'post',
		url : workPath + '/target/doTargetGroup.do?method=loadColumnPanel',
		dataType : 'json',
		async : false,
		data : "id=" + combox.value,
		success : function(data) {
			var d = data.datas;
			if (d != null && d != undefined && d != "") {
				/* 主要的代码开始 */
				var columnBox = Ext.getCmp("columnBox");
				var columns = columnBox.columns.length;
				var items = columnBox.items;
				var length = items.getCount();
				for ( var i = 0; i < length; i++) {
					var delItems = columnBox.items.items[0];
					delItems.destroy();
					columnBox.items.remove(delItems);
				}
				var col = columnBox.panel.items.get(0);
				for ( var i = 0; i < d.length; i++) {
					var chk = new Ext.form.Checkbox(d[i]);
					col = columnBox.panel.items.get(i % columns);
					col.add(chk);
					columnBox.items.add(chk);
				}
				columnBox.panel.doLayout();
				/* 主要的代码结束 */
			}
		}
	});
}
?

更新前:

?

更新后:点选combox更新所有checkbox


1 楼 wahaha603 2012-06-17  
这篇文章帮我解决了手上的问题,感谢楼主的分享。