Browse Source

按照comment修改

es6
windy 5 years ago
parent
commit
bdb58acf24
  1. 3
      src/base/tree/ztree/asynctree.js
  2. 27
      src/base/tree/ztree/treerender.service.js

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

@ -11,7 +11,8 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
_init: function () {
BI.AsyncTree.superclass._init.apply(this, arguments);
this.service = new BI.TreeRenderService({
id: this.id
id: this.id,
container: this.element
});
},

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

@ -12,10 +12,12 @@
this.id = this.options.id;
// renderService是否已经注册了滚动
this.hasBinded = false;
this.container = this.options.container;
},
_getNodeListBounds: function (tId) {
var nodeList = $("#" + this.id + " #" + tId + "_ul")[0];
var nodeList = BI.$("#" + this.id + " #" + tId + "_ul")[0];
return {
top: nodeList.offsetTop,
left: nodeList.offsetLeft,
@ -24,14 +26,17 @@
}
},
_getTreeContainerBounds: function() {
var nodeList = $("#" + this.id).parent()[0];
return {
top: nodeList.offsetTop + nodeList.scrollTop,
left: nodeList.offsetLeft + nodeList.scrollLeft,
width: nodeList.offsetWidth,
height: nodeList.offsetHeight
_getTreeContainerBounds: function () {
var nodeList = this.container[0];
if (BI.isNotNull(nodeList)) {
return {
top: nodeList.offsetTop + nodeList.scrollTop,
left: nodeList.offsetLeft + nodeList.scrollLeft,
width: nodeList.offsetWidth,
height: nodeList.offsetHeight
};
}
return {};
},
_canNodePopulate: function (tId) {
@ -50,7 +55,7 @@
},
_isNodeInVisible: function (tId) {
var nodeList = $("#" + this.id + " #" + tId + "_ul");
var nodeList = BI.$("#" + this.id + " #" + tId + "_ul");
return nodeList.length === 0 || nodeList.css("display") === "none";
},
@ -72,7 +77,7 @@
if(!this.hasBinded) {
// console.log("绑定事件");
this.hasBinded = true;
$("#" + this.id).parent().on("scroll", BI.debounce(function () {
this.container && this.container.on("scroll", BI.debounce(function () {
self.refreshAllNodes();
}, 30));
}
@ -109,7 +114,7 @@
});
this.nodeLists = {};
// console.log("解绑事件");
$("#" + this.id).parent().off("scroll");
this.container.off("scroll");
this.hasBinded = false;
}
});

Loading…
Cancel
Save