Remove Never End from repeating option

4 posts, 0 answers
  1. Logan
    Logan avatar
    49 posts
    Member since:
    Apr 2013

    Posted 01 Oct 2018 Link to this post

    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

  2. Peter Milchev
    Admin
    Peter Milchev avatar
    541 posts

    Posted 12 Oct 2018 Link to this post

    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.
  3. Logan
    Logan avatar
    49 posts
    Member since:
    Apr 2013

    Posted 16 Oct 2018 in reply to Peter Milchev Link to this post

    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.

  4. Peter Milchev
    Admin
    Peter Milchev avatar
    541 posts

    Posted 19 Oct 2018 Link to this post

    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
Back to Top