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

Remove Never End from repeating option

3 Answers 77 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Logan
Top achievements
Rank 1
Veteran
Logan asked on 01 Oct 2018, 08:14 PM

I am having to expand repeating events so I would like to remove the End: Never option and change the default.  The problem I have run into is that the code appears to be injected when the repeat option changes.

 

TIA

3 Answers, 1 is accepted

Sort by
0
Peter Milchev
Telerik team
answered on 12 Oct 2018, 06:38 AM
Hello Logan,

You can use the OnClientFormCreated event to change the recurrence as demonstrated below: 

<script>
    function OnClientFormCreated(sender, args) {
        var $ = $ || $telerik.$;
        if (args.get_formElement().classList.contains("rsAdvancedEdit")) {
            if (sender.get_renderMode() == 2) {
                //lightweight render mode
                var recurrenceDropdown = $(args.get_formElement()).find(".RecurrenceEditor .RadDropDownList")[0].control;
                if (recurrenceDropdown.get_selectedItem().get_value() == "None") {
                    // select another item
                    recurrenceDropdown.get_items().getItem(1).select();
                }
                // remove the 'Never' option
                recurrenceDropdown.get_items().removeAt(0);
            } else if (sender.get_renderMode() == 1) {
                // classic render mode
                var recurrenceCheckBox = $(args.get_formElement()).find(".RecurrenceEditor .rsAdvChkWrap input[type='checkbox']");
                if (!recurrenceCheckBox.prop("checked")) {
                    recurrenceCheckBox.click();
                }
                $(".RecurrenceEditor .rsAdvChkWrap").hide();
            }
        }
    }
</script>

Regards,
Peter Milchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Logan
Top achievements
Rank 1
Veteran
answered on 16 Oct 2018, 05:26 PM

How do I wire to the ClientFormCreated event?  I am not seeing it in the Scheduler.Events or DataSource.Events.

 

I am using the MVC fluent methods to build the scheduler in my view and I cannot find the ClientFormCreated in under the Scheduler.Events nor the DataSource.Events.

0
Peter Milchev
Telerik team
answered on 19 Oct 2018, 11:50 AM
Hello Logan,

The suggestions are for the RadScheduler for ASP.NET AJAX as this is the forum for the UI for ASP.NET AJAX suite. 

Anyways, the same functionality can be achieved for the Kendo UI products in the edit event as demonstrated in this dojo example - http://dojo.telerik.com/@pmilchev/aRozadeS 

edit: function (e) {
    var ddl = e.container.find("[data-role='recurrenceeditor'] .k-dropdown input").data('kendoDropDownList')
    if (ddl) {
        var data = ddl.dataSource.data();
        data = data.slice(1, 5);
        ddl.setDataSource(data);
        if (!e.event.recurrenceRule) {
            ddl.select(0)
            ddl.trigger("change");
        }
    }
}


Regards,
Peter Milchev
Progress Telerik
Tags
Scheduler
Asked by
Logan
Top achievements
Rank 1
Veteran
Answers by
Peter Milchev
Telerik team
Logan
Top achievements
Rank 1
Veteran
Share this question
or