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.

50 lines
1.5 KiB

8 years ago
/**
* 分段控件使用的button
*
* Created by GUY on 2015/9/7.
* @class BI.SegmentButton
* @extends BI.BasicButton
*/
BI.SegmentButton = BI.inherit(BI.BasicButton, {
8 years ago
_defaultConfig: function () {
8 years ago
var conf = BI.SegmentButton.superclass._defaultConfig.apply(this, arguments);
8 years ago
return BI.extend(conf, {
7 years ago
baseCls: (conf.baseCls || "") + " bi-segment-button bi-list-item-active",
8 years ago
shadow: true,
readonly: true,
8 years ago
hgap: 5
7 years ago
});
8 years ago
},
8 years ago
_init: function () {
8 years ago
BI.SegmentButton.superclass._init.apply(this, arguments);
var opts = this.options, self = this;
7 years ago
// if (BI.isNumber(opts.height) && BI.isNull(opts.lineHeight)) {
8 years ago
// this.element.css({lineHeight : (opts.height - 2) + 'px'});
7 years ago
// }
8 years ago
this.text = BI.createWidget({
type: "bi.label",
8 years ago
element: this,
8 years ago
height: opts.height - 2,
8 years ago
whiteSpace: opts.whiteSpace,
text: opts.text,
value: opts.value,
hgap: opts.hgap
7 years ago
});
8 years ago
},
8 years ago
setSelected: function () {
8 years ago
BI.SegmentButton.superclass.setSelected.apply(this, arguments);
},
8 years ago
setText: function (text) {
8 years ago
BI.SegmentButton.superclass.setText.apply(this, arguments);
this.text.setText(text);
},
8 years ago
destroy: function () {
8 years ago
BI.SegmentButton.superclass.destroy.apply(this, arguments);
}
});
7 years ago
BI.shortcut("bi.segment_button", BI.SegmentButton);