Results 1 to 9 of 9

Thread: How to disable days in calendar......

  1. #1

    Default How to disable days in calendar......

    Hi,

    Can somebody help me how to disable all the dates in every month except day one of the month like ["01/01/2008","01/02/2008" -- needs to be enabled ]

    I am using below method to disable weekends of every month

    Code:
    function
    datePicker(fieldName) { var dateField = new Ext.form.DateField({ name: fieldName, format: 'd-M-Y', disabledDays: [2,31], disabledDaysText: 'Its a Weekend!!', disabledDates:["01-Jan","25-Dec"], disabledDatesText: 'Its a Holiday', allowBlank:false }); return dateField;
    };
    Can somebody help me in this,

    Thanks in Advance,
    Murali

  2. #2
    Ext User denkoo's Avatar
    Join Date
    Jan 2008
    Location
    Paris
    Posts
    124

    Default May be it's so simple...

    look doc on Datefield

    disabledDates : Array
    An array of "dates" to disable, as strings. These strings will be used to build a dynamic regular expression so they ...
    An array of "dates" to disable, as strings. These strings will be used to build a dynamic regular expression so they are very powerful. Some examples:
    • ["03/08/2003", "09/16/2003"] would disable those exact dates
    • ["03/08", "09/16"] would disable those days for every year
    • ["^03/08"] would only match the beginning (useful if you are using short years)
    • ["03/../2006"] would disable every day in March 2006
    • ["^03"] would disable every day in every March
    In order to support regular expressions, if you are using a date format that has "." in it, you will have to escape the dot when restricting dates. For example: ["03\\.08\\.03"].


    for what you need :

    maybe :

    [".2/../....",".4/../....",".5/../....",".6/../....",".7/../....",".8/../....",".9/../....","1./../....","2./../....","3./../...."]


    but about User, I prefer on this possibility, using combo with all date it's possible...12 by year, it's not long list !

  3. #3

    Default

    Thank u Very Much....Its working fine

  4. #4

    Default

    But If i want to disable all dates except last day of the month......

  5. #5

    Default

    Can somebody share thoughts on this....

  6. #6

    Default

    Quote Originally Posted by ajax&me View Post
    But If i want to disable all dates except last day of the month......
    There are only 12 of those for a year, and they can be calculated easily.
    A date picker is the wrong ui metaphor for that. You just need a month picker...

    --dan

  7. #7
    Ext Premium Member
    Join Date
    Apr 2007
    Posts
    34

    Default Here's a twist...

    I have a similar situation where I want the user to pick only the first day of the month. I agree that a combo box would be a better solution since there are only twelve choices, but the problem is I also need to allow the user to select the year and I don't want to use a separate combo box for that. What I really want is a month and year selector like you see in the standard date picker when changing the month and year (see attached image).

    Any thoughts?
    Attached Images Attached Images

  8. #8
    Sencha User
    Join Date
    May 2008
    Posts
    17

    Default

    Quote Originally Posted by skippy View Post
    I have a similar situation where I want the user to pick only the first day of the month. I agree that a combo box would be a better solution since there are only twelve choices, but the problem is I also need to allow the user to select the year and I don't want to use a separate combo box for that. What I really want is a month and year selector like you see in the standard date picker when changing the month and year (see attached image).

    Any thoughts?

    try this one. ive been using it with no issues. http://extjs.com/forum/showthread.php?t=20181

  9. #9
    Ext Premium Member
    Join Date
    Apr 2007
    Posts
    34

    Default

    Dude, perfect! Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •