Home >Web Front-end >JS Tutorial >Detailed explanation of angular ztree ladder structure
$scope.initZtreeData = url = = res.respData; setting = zTree = $.fn.zTree.init($( functionLimitList = $.fn.zTree.getZTreeObj(
functionLimitList.setting.check.chkboxType = { "Y" : "ps", "N" : "ps" };//checkbox 选中/取消选中的时候关联到父子节点 p-父 s-子
<span style="color: #000000">}).error(function(){}); }; $scope.initZtreeData(); function zTreeOnCheck(){ $scope.getNodeDetail(); };<br><br><br>//点击节点时执行的回调</span>
$scope.getNodeDetail = function () { var treeObj = $.fn.zTree.getZTreeObj("functionLimitList"); var node = treeObj.getSelectedNodes();//点击节点后 获取节点数据 $scope.id = node[0].id; };
<br>
Default selected node: (Note: The default selected method should be called after the tree is successful to ensure that each check is successful)
$scope.roleZtreeDafultNodes = function () {var url = '/';//接口名var params = {// 参数 }; $http.post(url,params).success(function(res){var list = [110101,110102];//res.data里 获取到的节点idfor(var i=0;i<list.length;i++){var node = zTree.getNodeByParam("id",list[i]); zTree.checkNode(node); zTree.expandNode(node, true, true,true); zTree.selectNode(node); }; }).error(function(){}); }; $scope.roleZtreeDafultNodes();
The above is the detailed content of Detailed explanation of angular ztree ladder structure. For more information, please follow other related articles on the PHP Chinese website!