UNPKG

@ztree/ztree_v3

Version:

zTree is a multi-functional 'tree plug-ins.' based on jQuery. The main advantages of zTree includes excellent performance, flexible configuration, and the combination of multiple functions.

93 lines (89 loc) 3.17 kB
<!DOCTYPE html> <HTML> <HEAD> <TITLE> ZTREE DEMO - Radio halfCheck</TITLE> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" href="../../../css/demo.css" type="text/css"> <link rel="stylesheet" href="../../../css/zTreeStyle/zTreeStyle.css" type="text/css"> <script type="text/javascript" src="../../../js/jquery-1.4.4.min.js"></script> <script type="text/javascript" src="../../../js/jquery.ztree.core.js"></script> <script type="text/javascript" src="../../../js/jquery.ztree.excheck.js"></script> <!-- <script type="text/javascript" src="../../../js/jquery.ztree.exedit.js"></script> --> <SCRIPT type="text/javascript"> <!-- var setting = { async: { enable: true, url:"../asyncData/getNodes.php", autoParam:["id", "name=n", "level=lv"], otherParam:{"chk":"chk"} }, check: { enable: true, autoCheckTrigger: true, chkStyle: "radio", radioType: "level" }, data: { simpleData: { enable: true } }, callback: { onAsyncSuccess: onAsyncSuccess } }; function onAsyncSuccess(event, treeId, treeNode, msg) { cancelHalf(treeNode); } function cancelHalf(treeNode) { var zTree = $.fn.zTree.getZTreeObj("treeDemo"); treeNode.halfCheck = false; zTree.updateNode(treeNode); } var zNodes =[ { id:1, pId:0, name:"half 1", halfCheck:true, isParent:true}, { id:2, pId:0, name:"half 2", halfCheck:true, checked:true, isParent:true}, { id:3, pId:0, name:"no half 3", isParent:true} ]; $(document).ready(function(){ $.fn.zTree.init($("#treeDemo"), setting, zNodes); }); //--> </SCRIPT> </HEAD> <BODY> <h1>Radio halfCheck Demo</h1> <h6>[ File Path: excheck/radio_halfCheck.html ]</h6> <div class="content_wrap"> <div class="zTreeDemoBackground left"> <ul id="treeDemo" class="ztree"></ul> </div> <div class="right"> <ul class="info"> <li class="title"><h2>1, Explanation of Demo</h2> <ul class="list"> <li>This demo implements the check operation of the dynamic tree</li> <li class="highlight_red">1). After loaded child nodes, the parent node's 'halfCheck' attribute will be invalid immediately.</li> <li class="highlight_red">2). If you check the parent node, will not effect the child nodes's check status.</li> <li class="highlight_red">3). If you check the parent node, it's child node's 'halfCheck' attribute will still be valid.</li> </ul> </li> <li class="title"><h2>2, Explanation of setting</h2> <ul class="list"> <li>Half-checked functional don't need to configure any parameter. But it is accessibility, can not used alone. So please configure the parameters which you need.</li> </ul> </li> <li class="title"><h2>3, Explanation of treeNode</h2> <ul class="list"> <li class="highlight_red">1), Please set treeNode.halfCheck attribute, before zTree initialize. See the API documentation for more related contents.</li> <li>2), By the way, please see the 'Radio Operation' Demo.</li> </ul> </li> </ul> </div> </div> </BODY> </HTML>