easyui-combotree 下拉选择框的使用

easyui-combotree 下拉选择框的使用

参照EasyUI Combotree :http://www.jeasyui.net/plugins/170.html

1、引入两个js

<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery.easyui.min.js"></script>

2、body内容使用

<tr style="display: none;" id="tdgNames">
                <td valign='middle' align='right' bordercolordark='#EEEEEE'
                    bordercolorlight='#CCCCCC'>
                    居民小组
                </td>
                <td>
                <select id="ddlLine"  name="user.groupNames" class="easyui-combotree" style="width: 91px; height: 24px;">
                </select>

                    <font color=red>*</font>
                </td>
            </tr>

3、js,加载数据

var treejson=gNamesList('<%=request.getContextPath()%>');
$('#ddlLine').combotree({
  valueField: "id", //Value字段
  textField: "text", //Text字段
  multiple: true,
  data:JSON.parse(treejson), 
  onCheck: function (node, checked) {
   //让全选不显示
   $("#ddlLine").combotree("setText", $("#ddlLine").combobox("getText").toString().replace("全选,", ""));
  },
  onClick: function (node, checked) {
   //让全选不显示
   $("#ddlLine").combotree("setText", $("#ddlLine").combobox("getText").toString().replace("全选,", ""));
  }
  });  
         
 });   

猜你喜欢

转载自blog.csdn.net/weixin_38948287/article/details/82142477