ExtJs3.0 Ext.form.CheckboxGroup批量取值和设值方法
/** 设值方法
* @param {Ext.form.CheckboxGroup} boxGroup
* @param {Array} value
*/
function SetBoxGroupValues(boxGroup,value){
var valueText=","+value+",";
var valuesChecked=new Array();
boxGroup.eachItem(function (item){
index=valueText.indexOf(","+item.inputValue+",");
item.setValue(index>-1?true:false);
});
}
/** 取值方法
* @param {Ext.form.CheckboxGroup} boxGroup
* @return {String}
*/
function GetBoxGroupValues(boxGroup)
{
var valueText="";
boxGroup.eachItem(function (item){
if(!item.checked) return;
if(valueText==="")
{
valueText=item.inputValue;
}else
{
valueText+=","+item.inputValue;
}
});
return valueText;
}