Controlling RecurrenceEditor.

3 posts, 1 answers
  1. Answer
    Pär Sandgren
    Pär Sandgren avatar
    7 posts
    Member since:
    Dec 2013

    Posted 18 Dec 2013 Link to this post

    Hi there,

    I would like to disable or remove the <li> containing the "never" radiobutton, to force the user to set an end for the task. I managed to do this on the edit-event, but only for existing tasks. When I tried to hook the "change"-event of the recurrenceEditor, I couldn't get the selector $(':radio[value="never"]') to work. This part is undocumented, and a bit hard to "guess". Anyone got a hint?

    Some example code:
    01.<div data-container-for="recurrenceRule" class="k-edit-field">
    02.    <div data-bind="value:recurrenceRule" id="recurrenceEditorDiv"></div>
    03.    <script>
    04.        $(function() {
    05.            $("\#recurrenceEditorDiv").kendoRecurrenceEditor(
    06.            {
    07.                frequencies: ["never", "weekly"],
    08.                change: function(e) {
    09.                    // This would be nice if it worked
    10.                    var rb = e.container.find(".k-recur-end-never");
    11.                    rb.attr('disabled', 'disabled');
    12. 
    13.                    // Or this. This works in the grid's "edit"-event
    14.                    var li = e.container.find(".k-recur-end-never")
    15.                                        .parent()
    16.                                        .parent();
    17.                    li.remove();
    18.                },
    19.                messages: {
    20.                    end: {
    21.                        after: " efter ",
    22.                        occurrence: " händelse(r)",
    23.                        label: "Slut",
    24.                        never: " aldrig",
    25.                        on: " på "
    26.                    },
    27.                    frequencies: {
    28.                        weekly: "per vecka",
    29.                        never: "aldrig",
    30.                    },
    31.                    offsetPositions: {
    32.                        first: "första",
    33.                        second: "andra",
    34.                        third: "tredje",
    35.                        fourth: "fjärde",
    36.                        last: "sista"
    37.                    },
    38.                    weekly: {
    39.                        interval: " vecka(or)",
    40.                        repeatEvery: "Intervall",
    41.                        repeatOn: "Dagar "
    42.                    },
    43.                    weekdays: {
    44.                        day: "Dag",
    45.                        weekday: "Veckodag",
    46.                        weekend: "Helgdag"
    47.                    }
    48.                }
    49.            });
    50.        });
    51.    <\/script>
    52.</div>
  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 19 Dec 2013 Link to this post

    Hello Par,

    In general, the recurrence editor is not designed to allow control over end pattern. I will suggest you open a user voice discussion on this subject, as this is will be a great way to gather community feedback about that functionality.

    If this is a must for you to stop the never  option then you can hide/disable the first radio button like it is shown here. Please note that the suggested approach is a custom solution and I cannot guarantee it will work in future releases. 

    Regards,
    Georgi Krustev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Pär Sandgren
    Pär Sandgren avatar
    7 posts
    Member since:
    Dec 2013

    Posted 19 Dec 2013 Link to this post

    Thank you Georgi!

    This solution is more than enough. This is for a very special solution, for a special customer. My personal thought of this being stupid idea wasn't enough for them so I guess they will have to live with it. Hopefully I won't have to do this again.

    // Pär
Back to Top