You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.8 KiB
67 lines
1.8 KiB
8 years ago
|
/**
|
||
|
* guy
|
||
|
* 异步树
|
||
|
* @class BI.DisplayTree
|
||
|
* @extends BI.TreeView
|
||
|
*/
|
||
|
BI.DisplayTree = BI.inherit(BI.TreeView, {
|
||
|
_defaultConfig: function () {
|
||
|
return BI.extend(BI.DisplayTree.superclass._defaultConfig.apply(this, arguments), {
|
||
|
extraCls: "bi-display-tree"
|
||
7 years ago
|
});
|
||
8 years ago
|
},
|
||
|
|
||
7 years ago
|
// 配置属性
|
||
8 years ago
|
_configSetting: function () {
|
||
|
var setting = {
|
||
|
view: {
|
||
|
selectedMulti: false,
|
||
|
dblClickExpand: false,
|
||
|
showIcon: false,
|
||
7 years ago
|
nameIsHTML: true,
|
||
8 years ago
|
showTitle: false
|
||
|
},
|
||
|
data: {
|
||
|
key: {
|
||
|
title: "title",
|
||
|
name: "text"
|
||
|
},
|
||
|
simpleData: {
|
||
|
enable: true
|
||
|
}
|
||
|
},
|
||
|
callback: {
|
||
|
beforeCollapse: beforeCollapse
|
||
|
}
|
||
|
};
|
||
|
|
||
6 years ago
|
function beforeCollapse(treeId, treeNode) {
|
||
8 years ago
|
return false;
|
||
|
}
|
||
|
|
||
|
return setting;
|
||
|
},
|
||
|
|
||
8 years ago
|
_dealWidthNodes: function (nodes) {
|
||
|
nodes = BI.DisplayTree.superclass._dealWidthNodes.apply(this, arguments);
|
||
|
var self = this, o = this.options;
|
||
|
BI.each(nodes, function (i, node) {
|
||
6 years ago
|
node.isParent = node.isParent || node.parent;
|
||
7 years ago
|
if (node.text == null) {
|
||
|
if (node.count > 0) {
|
||
|
node.text = node.value + "(" + BI.i18nText("BI-Basic_Altogether") + node.count + BI.i18nText("BI-Basic_Count") + ")";
|
||
|
}
|
||
8 years ago
|
}
|
||
|
});
|
||
|
return nodes;
|
||
|
},
|
||
|
|
||
8 years ago
|
initTree: function (nodes, setting) {
|
||
|
var setting = setting || this._configSetting();
|
||
5 years ago
|
this.nodes = BI.$.fn.zTree.init(this.tree.element, setting, nodes);
|
||
8 years ago
|
}
|
||
|
});
|
||
|
BI.DisplayTree.EVENT_CHANGE = "EVENT_CHANGE";
|
||
|
|
||
4 years ago
|
BI.shortcut("bi.display_tree", BI.DisplayTree);
|