//区号只能选子节点 $("#quhao").combotree({ onBeforeSelect: function (node) { //返回树对象 var tree = $(this).tree; //选中的节点是否为叶子节点,如果不是叶子节点,清除选中 var isLeaf = tree('isLeaf', node.target); if (!isLeaf) { $("#quhao").treegrid("unselect"); } }
easyui中的树可以从标记中建立,也可以通过指定一个URL属性读取数据建立.如果想建立一棵异步树,需要为每个节点指定一个id属性值,这样在加载数据时会自动向后台传递id参数. <ul id="tt"></ul> 编写前台代码: $('#tt').tree({ url:'/demo2/node/getNodes' // The url will be mapped to NodeController class and getNodes method }); 为
利用loadFilter对后台返回的原始数据进行过滤处理,将数据中的state字段修改相应的值,若无子节点,则改成open,若有子节点,则改成closed. 由于一个node属性只有下面几项内容,因此利用checked字段,于是有了下面的sql查询语句, id: An identity value bind to the node. text: Text to be showed. iconCls: The css class to display icon. checked: Whether