This is a migrated thread and some comments may be shown as answers.

Calendar Disable Weekends( display only not selectable )

3 Answers 846 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
vijay
Top achievements
Rank 1
vijay asked on 18 May 2015, 09:23 AM

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

3 Answers, 1 is accepted

Sort by
0
Antony Jekov
Telerik team
answered on 20 May 2015, 10:25 AM
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
0
vijay
Top achievements
Rank 1
answered on 21 May 2015, 04:38 AM

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

0
Antony Jekov
Telerik team
answered on 26 May 2015, 07:22 AM
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
Tags
Calendar
Asked by
vijay
Top achievements
Rank 1
Answers by
Antony Jekov
Telerik team
vijay
Top achievements
Rank 1
Share this question
or