|
|
|
@ -18,6 +18,35 @@ BI.MonthPopup = BI.inherit(BI.Widget, {
|
|
|
|
|
BI.MonthPopup.superclass._init.apply(this, arguments); |
|
|
|
|
var self = this, o = this.options; |
|
|
|
|
|
|
|
|
|
this.month = BI.createWidget({ |
|
|
|
|
type: "bi.button_group", |
|
|
|
|
element: this, |
|
|
|
|
behaviors: o.behaviors, |
|
|
|
|
items: BI.createItems(this._getItems(o.allowMonths), {}), |
|
|
|
|
layouts: [BI.LogicFactory.createLogic("table", BI.extend({ |
|
|
|
|
dynamic: true |
|
|
|
|
}, { |
|
|
|
|
columns: 2, |
|
|
|
|
rows: 6, |
|
|
|
|
columnSize: [1 / 2, 1 / 2], |
|
|
|
|
rowSize: 25 |
|
|
|
|
})), { |
|
|
|
|
type: "bi.center_adapt", |
|
|
|
|
vgap: 1, |
|
|
|
|
hgap: 2 |
|
|
|
|
}], |
|
|
|
|
value: o.value |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.month.on(BI.Controller.EVENT_CHANGE, function (type) { |
|
|
|
|
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
|
|
|
|
if (type === BI.Events.CLICK) { |
|
|
|
|
self.fireEvent(BI.MonthPopup.EVENT_CHANGE); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_getItems: function(m) { |
|
|
|
|
// 纵向排列月
|
|
|
|
|
var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12]; |
|
|
|
|
var items = []; |
|
|
|
@ -39,37 +68,17 @@ BI.MonthPopup = BI.inherit(BI.Widget, {
|
|
|
|
|
height: 23, |
|
|
|
|
width: 38, |
|
|
|
|
value: td, |
|
|
|
|
text: td |
|
|
|
|
text: td, |
|
|
|
|
disabled: !BI.contains(m, td) |
|
|
|
|
}; |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.month = BI.createWidget({ |
|
|
|
|
type: "bi.button_group", |
|
|
|
|
element: this, |
|
|
|
|
behaviors: o.behaviors, |
|
|
|
|
items: BI.createItems(items, {}), |
|
|
|
|
layouts: [BI.LogicFactory.createLogic("table", BI.extend({ |
|
|
|
|
dynamic: true |
|
|
|
|
}, { |
|
|
|
|
columns: 2, |
|
|
|
|
rows: 6, |
|
|
|
|
columnSize: [1 / 2, 1 / 2], |
|
|
|
|
rowSize: 25 |
|
|
|
|
})), { |
|
|
|
|
type: "bi.center_adapt", |
|
|
|
|
vgap: 1, |
|
|
|
|
hgap: 2 |
|
|
|
|
}], |
|
|
|
|
value: o.value |
|
|
|
|
}); |
|
|
|
|
return items; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
this.month.on(BI.Controller.EVENT_CHANGE, function (type) { |
|
|
|
|
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
|
|
|
|
if (type === BI.Events.CLICK) { |
|
|
|
|
self.fireEvent(BI.MonthPopup.EVENT_CHANGE); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
populate: function(months) { |
|
|
|
|
this.month.populate(this._getItems(months)); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
getValue: function () { |
|
|
|
|