From 462d123ce314aaa78c54ef42b4f0ee6356765062 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Tue, 3 Mar 2020 13:57:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BE=9B=E8=8E=B7=E5=8F=96=E5=AD=90?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E5=88=97=E8=A1=A8=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/tree/ztree/asynctree.js | 7 ++++++- src/base/tree/ztree/treerender.service.js | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/base/tree/ztree/asynctree.js b/src/base/tree/ztree/asynctree.js index 1c6ed5395..67f9f7a01 100644 --- a/src/base/tree/ztree/asynctree.js +++ b/src/base/tree/ztree/asynctree.js @@ -10,9 +10,14 @@ BI.AsyncTree = BI.inherit(BI.TreeView, { }, _init: function () { BI.AsyncTree.superclass._init.apply(this, arguments); + var self = this; this.service = new BI.TreeRenderService({ id: this.id, - container: this.element + container: this.element, + subNodeListGetter: function (tId) { + // 获取待检测的子节点列表, ztree并没有获取节点列表dom的API, 此处使用BI.$获取 + return BI.$("#" + self.id + " #" + tId + "_ul"); + } }); }, diff --git a/src/base/tree/ztree/treerender.service.js b/src/base/tree/ztree/treerender.service.js index 5789ae16e..d953c6568 100644 --- a/src/base/tree/ztree/treerender.service.js +++ b/src/base/tree/ztree/treerender.service.js @@ -17,7 +17,7 @@ }, _getNodeListBounds: function (tId) { - var nodeList = BI.$("#" + this.id + " #" + tId + "_ul")[0]; + var nodeList = this.options.subNodeListGetter(tId)[0]; return { top: nodeList.offsetTop, left: nodeList.offsetLeft, @@ -55,7 +55,7 @@ }, _isNodeInVisible: function (tId) { - var nodeList = BI.$("#" + this.id + " #" + tId + "_ul"); + var nodeList = this.options.subNodeListGetter(tId); return nodeList.length === 0 || nodeList.css("display") === "none"; },