PDA

View Full Version : [2.2] DateField method: setDisabledDates()



corpse_br
22 Aug 2008, 7:16 AM
If the method is called by the DateField AND before the click event that generates the DatePicker:


setDisabledDates : function(dd){
this.disabledDates = dd;
this.initDisabledDays();
if(this.menu){ //if it still doesn't exist
this.menu.picker.setDisabledDates(this.disabledDatesRE); // then disabledDatesRE won't be passed to the picker
}
},



but onTriggerClick


Ext.apply(this.menu.picker, {
minDate : this.minValue,
maxDate : this.maxValue,
disabledDatesRE : this.ddMatch, // ddMatch is passed to the picker!?
...


A full example, with the workaround:


Ext.onReady(function(){
p = new Ext.Panel({
renderTo: 'cell',
items: [{
xtype:'datefield',
id:'date',
fieldLabel : 'Date Max. for Backup',
name : 'datemax',
emptyText : 'Select a Date...',
disabledDays : [0,6],
format:'m/d/Y',
width : 150,
allowBlank : false,
minValue : new Date().add(Date.DAY, 3),

listeners: { beforerender : function(that){
//should do ajax request and put the results on "dd"
dd = ['08/27/2008','08/28/2008'];
this.setDisabledDates(dd);
this.ddMatch = this.disabledDatesRE; // <---- 2 vars doing the same?
}}
}]
});
});

Condor
24 Aug 2008, 9:31 PM
Partial duplicate of this post (http://extjs.com/forum/showthread.php?t=44781).