Browse Source

提供获取子节点列表的方法

es6
windy 5 years ago
parent
commit
462d123ce3
  1. 7
      src/base/tree/ztree/asynctree.js
  2. 4
      src/base/tree/ztree/treerender.service.js

7
src/base/tree/ztree/asynctree.js

@ -10,9 +10,14 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
}, },
_init: function () { _init: function () {
BI.AsyncTree.superclass._init.apply(this, arguments); BI.AsyncTree.superclass._init.apply(this, arguments);
var self = this;
this.service = new BI.TreeRenderService({ this.service = new BI.TreeRenderService({
id: this.id, id: this.id,
container: this.element container: this.element,
subNodeListGetter: function (tId) {
// 获取待检测的子节点列表, ztree并没有获取节点列表dom的API, 此处使用BI.$获取
return BI.$("#" + self.id + " #" + tId + "_ul");
}
}); });
}, },

4
src/base/tree/ztree/treerender.service.js

@ -17,7 +17,7 @@
}, },
_getNodeListBounds: function (tId) { _getNodeListBounds: function (tId) {
var nodeList = BI.$("#" + this.id + " #" + tId + "_ul")[0]; var nodeList = this.options.subNodeListGetter(tId)[0];
return { return {
top: nodeList.offsetTop, top: nodeList.offsetTop,
left: nodeList.offsetLeft, left: nodeList.offsetLeft,
@ -55,7 +55,7 @@
}, },
_isNodeInVisible: function (tId) { _isNodeInVisible: function (tId) {
var nodeList = BI.$("#" + this.id + " #" + tId + "_ul"); var nodeList = this.options.subNodeListGetter(tId);
return nodeList.length === 0 || nodeList.css("display") === "none"; return nodeList.length === 0 || nodeList.css("display") === "none";
}, },

Loading…
Cancel
Save