Home  >  Article  >  Web Front-end  >  Detailed explanation of angular ztree ladder structure

Detailed explanation of angular ztree ladder structure

零下一度
零下一度Original
2017-06-26 10:41:442395browse
$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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn