<tr>
<th><spring:message code="wf.borrow.examiner"/></th>
<td>
<input id="inp-examiner1" type="text" name="examiner1" style="width:197px;height:20px;" data-options="required:true"/>
</td>
</tr>
$("#inp-examiner1").combotree({
url : '${ctx}/employ/deptEmployeeTreeSpare?orgno=${sessionInfo.orgno}',
parentField : 'pid',
lines : true,
checkbox: true ,
panelHeight : 'auto' ,
/* 关闭所有子节点 */
onLoadSuccess: function (row, data) {
$("#inp-examiner1").combotree('tree').tree("collapseAll");
},
/* 父节点不可选中 */
onBeforeSelect: function(node) {
if (!$(this).tree('isLeaf', node.target)) {
return false;
}
},
/* 点击父节点不关闭弹出框*/
onClick: function(node) {
if (!$(this).tree('isLeaf', node.target)) {
$("#inp-examiner1").combo('showPanel');
}
}
});
创建实体类
id为节点id 也是返回的id
pid记录父节点id
text 显示文本
public class Tree implements java.io.Serializable {
private String id;
private String text;
private String state = "open";// open,closed
private boolean checked = false;
private Object attributes;
private List<Tree> children;
private String iconCls;
private String pid;