PDA

View Full Version : Help with DatePicker



VATigers
22 Feb 2009, 5:30 PM
Hi All,

I am trying to get working, the 'disabledDatesRE' property of datepicker.
But I either land up disabling all the days or no days.

I am trying to disable all the days in feb.

Can anyone let me know what I am missing here.


var dp = new Ext.DatePicker({
renderTo: Ext.getBody(),
disabledDatesRE: new RegExp("[02/../2009]"),
listeners: {
'select': function(date_picker, date)
{
alert(date.getFullYear() + '-' + (parseInt(date.getMonth()) + 1) + '-' + date.getDay());
}
}
});

22 Feb 2009, 8:01 PM
why use a regex. did you look at the API for the datepicker? they show some clear examples on how to do a month, etc.

VATigers
22 Feb 2009, 8:54 PM
We are creating a .Net wrapper for ExtJs controls to use in our project.


I was playing around with the datepicker control and wanted to know how to use the disabledDatesRE property.

Any help on how to use this property is really appreciable.

VATigers
23 Feb 2009, 9:03 AM
ok, I found the solution. Spent couple of hours along with my colleague and finally figured it out.


var dp = new Ext.DatePicker({
renderTo: Ext.getBody(),
disabledDatesRE: new RegExp("(?:11/../09|12/17/09)"),

listeners: {
'select': function(date_picker, date)
{
alert(date.getFullYear() + '-' + (parseInt(date.getMonth()) + 1) + '-' + date.getDay());
}
}
});


This would disable all the days in November for 2009 and 12/17/2009

VATigers
23 Feb 2009, 10:13 AM
This post helped me with the problem.

http://extjs.com/forum/showthread.php?p=293155#post293155