Calendar Disable Weekends( display only not selectable )

4 posts, 0 answers
  1. vijay
    vijay avatar
    23 posts
    Member since:
    May 2015

    Posted 18 May 2015 Link to this post

    Hello,

    Our requirement needs that we only allow cells that fall on week
    days to be enabled. Searching through the documentation the only
    reference I've found to disabling cells requires a min and max date
    which creates a range of enabled cells while the rest are disabled, we essentially only want the weekends to be
    disabled.

    Thanks for your time,

    Vijay

  2. Antony Jekov
    Admin
    Antony Jekov avatar
    88 posts

    Posted 20 May 2015 Link to this post

    Hello Kumar,

    Thank you for writing.

    If you want to address the properties of a cell based on a specific rule, such as disabling only weekends, then you can use a customization rule. Here is an example code of doing this:
    final Calendar calendar = Calendar.getInstance();
    calendarView.setCustomizationRule(new Procedure<CalendarCell>() {
        @Override
        public void apply(CalendarCell argument) {
            if (argument instanceof CalendarDayCell) {
                calendar.setTimeInMillis(argument.getDate());
                ((CalendarDayCell) argument).setSelectable(
                        !(calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY ||
                        calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY));
            }
        }
    });

    I hope this is what you are looking for.

    Thank you for your time and all best!

    Regards,
    Antony Jekov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
  4. vijay
    vijay avatar
    23 posts
    Member since:
    May 2015

    Posted 20 May 2015 in reply to Antony Jekov Link to this post

    Hi Antony,

     Thanks Man it's works!!!!

    I also want to add with this functionality color code. weekends in different color ,week days in different different color.

     "weekends is disabled +weekends in different color + week days in different different color"  I tried this works together but not succeed.

    please help me out of this and provide me solution for this

     

    Thanks Again

  5. Antony Jekov
    Admin
    Antony Jekov avatar
    88 posts

    Posted 26 May 2015 Link to this post

    Answered in ticket #938451.

    Regards,
    Antony Jekov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
DevCraft banner