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.

73 lines
2.1 KiB

/**
* 年份 + 月份下拉框
*
* @class BI.YearMonthCombo
* @extends BI.Widget
*/
BI.YearMonthCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.YearMonthCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-year-month-combo",
8 years ago
yearBehaviors: {},
monthBehaviors: {},
height: 25
});
},
_init: function () {
BI.YearMonthCombo.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.month = BI.createWidget({
8 years ago
type: "bi.month_combo",
behaviors: o.monthBehaviors,
value: o.value.month
});
8 years ago
this.year.on(BI.YearCombo.EVENT_CONFIRM, function () {
self.fireEvent(BI.YearMonthCombo.EVENT_CONFIRM);
});
8 years ago
this.year.on(BI.YearCombo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.YearMonthCombo.EVENT_BEFORE_POPUPVIEW);
});
8 years ago
this.month.on(BI.MonthCombo.EVENT_CONFIRM, function () {
7 years ago
self.getValue();
self.fireEvent(BI.YearMonthCombo.EVENT_CONFIRM);
});
8 years ago
this.month.on(BI.MonthCombo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.YearMonthCombo.EVENT_BEFORE_POPUPVIEW);
});
BI.createWidget({
type: "bi.center",
element: this,
hgap: 5,
items: [this.year, this.month]
});
},
setValue: function (v) {
v = v || {};
this.month.setValue(v.month);
this.year.setValue(v.year);
},
getValue: function () {
return {
year: this.year.getValue(),
month: this.month.getValue()
};
}
});
BI.YearMonthCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
8 years ago
BI.YearMonthCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
7 years ago
BI.shortcut("bi.year_month_combo", BI.YearMonthCombo);