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

how to edit recurrenceeditor?

3 Answers 259 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
宏吉
Top achievements
Rank 1
宏吉 asked on 12 Jul 2017, 09:35 AM
I want remove the options day,weekend and weekday in the dropdownlist  ,how to do this?

3 Answers, 1 is accepted

Sort by
0
Accepted
Sayer
Top achievements
Rank 1
answered on 13 Jul 2017, 03:39 PM

You can add a change event to the recurrence editor in the edit event of the scheduler (which triggers when you try to open the event editor window).

var recurEditor = externalEditor.find('[data-role=recurrenceeditor]').data('kendoRecurrenceEditor');
                                if(recurEditor != undefined){
                                    recurEditor.setOptions({
                                        start: new Date(e.event.start),
                                        change: function(e){
                                            //console.log('Changing Recurrence', e);
                                            var currentFreq = e.sender._frequency.value();
                                            var lastOccurrenceDate = new Date($('#startTimeInput').data('kendoDateTimePicker').value().getTime());
                                            //console.log(kendo.toString(lastOccurrenceDate, 'ddd MMM dd yyyy'));
                                            var recurrenceInterval = e.sender._container.find('.k-formatted-value.k-recur-interval.k-input');
                                           
                                            if(currentFreq == 'monthly' || currentFreq == 'yearly'){
                                                var monthlyDataSource = e.sender._weekDay.dataSource.data();
                                            for(var i = 0; i < monthlyDataSource.length; i++){
                                            if(monthlyDataSource[i].text == 'weekday' || monthlyDataSource[i].text == 'weekend day'){
                                                    monthlyDataSource.splice(i, 1);
                                                }
                                            }
                                            }
                                        }
                                    });
                                    
                                    
                              }

That example shows something I did to remove weekday and weekend day from drop down to select first, second, third, etc. weekday, weekend day, day, monday, tuesday, etc etc. in the recurrence editor. You will need to do something similar in the change event of the recurrence editor to modify its contents.

0
Sayer
Top achievements
Rank 1
answered on 13 Jul 2017, 03:41 PM
Also, setting the 'start' like I have, will determine which day checkboxes are selected in the recurrence editor based on what the start date is.
0
宏吉
Top achievements
Rank 1
answered on 14 Jul 2017, 03:29 AM
that is work thank you~~~~~
Tags
Scheduler
Asked by
宏吉
Top achievements
Rank 1
Answers by
Sayer
Top achievements
Rank 1
宏吉
Top achievements
Rank 1
Share this question
or