Here is an implementation that allows you to add this event by extending class 'Ext.picker.Date':
Ext.define("YourCalendarPicker", {
extend: "Ext.picker.Date",
...
update : function(date, forceRefresh){
var me = this,
monthViewChange = me.isAnotherMonthView(date);
me.callParent(arguments);
if (monthViewChange){
me.fireEvent("monthviewchange", me, date, me.activeDate);
}
return me;
},
...
/**
* return true if the given date is in a different month view of the actual calendar date
* @param {Date} date
* @return {Boolean}
*/
isAnotherMonthView: function(date){
var activeDate = this.activeDate || date;
return date.getYear() != activeDate.getYear() ||
date.getMonth() != activeDate.getMonth();
}
};
No comments:
Post a Comment