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.

72 lines
2.1 KiB

/**
* 年份 + 月份下拉框
*
* @class BI.YearQuarterCombo
* @extends BI.Widget
*/
BI.YearQuarterCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.YearQuarterCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-year-quarter-combo",
8 years ago
yearBehaviors: {},
quarterBehaviors: {},
height: 25
});
},
_init: function () {
BI.YearQuarterCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
o.value = o.value || {};
this.year = BI.createWidget({
8 years ago
type: "bi.year_combo",
behaviors: o.yearBehaviors,
value: o.value.year
});
this.quarter = BI.createWidget({
8 years ago
type: "bi.quarter_combo",
behaviors: o.quarterBehaviors,
value: o.value.quarter
});
8 years ago
this.year.on(BI.YearCombo.EVENT_CONFIRM, function () {
self.fireEvent(BI.YearQuarterCombo.EVENT_CONFIRM);
});
8 years ago
this.year.on(BI.YearCombo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.YearQuarterCombo.EVENT_BEFORE_POPUPVIEW);
});
8 years ago
this.quarter.on(BI.QuarterCombo.EVENT_CONFIRM, function () {
self.fireEvent(BI.YearQuarterCombo.EVENT_CONFIRM);
});
8 years ago
this.quarter.on(BI.QuarterCombo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.YearQuarterCombo.EVENT_BEFORE_POPUPVIEW);
});
BI.createWidget({
type: "bi.center",
element: this,
hgap: 5,
items: [this.year, this.quarter]
});
},
setValue: function (v) {
v = v || {};
this.quarter.setValue(v.quarter);
this.year.setValue(v.year);
},
getValue: function () {
return {
year: this.year.getValue(),
quarter: this.quarter.getValue()
};
}
});
BI.YearQuarterCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
8 years ago
BI.YearQuarterCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
7 years ago
BI.shortcut("bi.year_quarter_combo", BI.YearQuarterCombo);