fineui是帆软报表和BI产品线所使用的前端框架。
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.

55 lines
1.4 KiB

8 years ago
/**
* 表示一个可以展开的节点, 不仅有选中状态而且有展开状态
*
* Created by GUY on 2015/9/9.
* @class BI.NodeButton
* @extends BI.BasicButton
* @abstract
*/
BI.NodeButton = BI.inherit(BI.BasicButton, {
7 years ago
_defaultConfig: function () {
8 years ago
var conf = BI.NodeButton.superclass._defaultConfig.apply(this, arguments);
3 years ago
return BI.extend(conf, {
_baseCls: (conf._baseCls || "") + " bi-node",
open: false,
once: false,
7 years ago
});
8 years ago
},
3 years ago
_initRef: function () {
3 years ago
if (this.isOpened()) {
this.setOpened(this.isOpened());
}
3 years ago
BI.NodeButton.superclass._initRef.apply(this, arguments);
8 years ago
},
7 years ago
doClick: function () {
8 years ago
BI.NodeButton.superclass.doClick.apply(this, arguments);
this.setOpened(!this.isOpened());
},
7 years ago
isOpened: function () {
8 years ago
return !!this.options.open;
},
7 years ago
setOpened: function (b) {
8 years ago
this.options.open = !!b;
},
7 years ago
triggerCollapse: function () {
3 years ago
if (this.isOpened()) {
8 years ago
this.setOpened(false);
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, this.getValue(), this);
}
},
7 years ago
triggerExpand: function () {
3 years ago
if (!this.isOpened()) {
8 years ago
this.setOpened(true);
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, this.getValue(), this);
}
},
});
BI.shortcut("bi.node_button", BI.NodeButton);