概述
获取当前combotree选中的节点,但是是数组,可以遍历数组转换成string类型,遍历方法可参考文章js遍历方法,选取效率最高的方法。
< input class = "easyui-combotree"style = "width:150px"type = "text"
id = "citys" name = "city" class = "easyui-validatebox"
data-options = "prompt:'城市',required:true,multiple:true,missingMessage:'请添加城市'" >
//
$('#citys').combotree({
url: 'city/getTreeData.do',
valueField: 'id',
textField: 'text',
multiple: true,
checkbox: true
});
//获取当前combotree的tree对象
var tree = $('#citys').combotree('tree');
//获取当前选中的节点
var data = tree.tree('getChecked');
var idString = "";
for (i = 0, len = data.length; i < len; i++) {
idString += data[i].id + ",";
}
//截取最后一个逗号
var idStrings = idString.substring(0, idString.length - 1);
本文介绍如何使用EasyUI的Combotree插件进行多选操作,包括设置多选属性、获取已选中节点,并将节点ID转换为字符串形式。通过遍历获取的节点数组,可以有效地处理选中的多项数据。
3510

被折叠的 条评论
为什么被折叠?



