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

Controlling RecurrenceEditor.

7 Answers 283 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Pär Sandgren
Top achievements
Rank 1
Pär Sandgren asked on 18 Dec 2013, 09:32 AM
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>

7 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 19 Dec 2013, 12:40 PM
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!
0
Pär Sandgren
Top achievements
Rank 1
answered on 19 Dec 2013, 12:52 PM
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
0
Simon
Top achievements
Rank 1
answered on 26 Jan 2018, 02:27 PM

Resurrecting an old thread here but is this still the only/recommmended way to hide the Never radio button for the end pattern in the recurrence editor? It would be great if there was a declarative way of doing this similar to the frequency options:

 

<div data-container-for="recurrenceRule" class="k-edit-field">
    @(Html.Kendo().RecurrenceEditorFor(model => model.RecurrenceRule)
        .HtmlAttributes(new { data_bind = "value:recurrenceRule" })
        .Frequency(frequency => frequency
            .Add(RecurrenceEditorFrequency.Never)
            .Add(RecurrenceEditorFrequency.Daily)
            .Add(RecurrenceEditorFrequency.Weekly)
            .Add(RecurrenceEditorFrequency.Monthly)
            )
        )
</div>

 

Similar to the OP, it's more of a user issue here, we really don't want some one to pick a recurrence of Daily and an end of Never! 

Thanks.

Simon

 

0
Neli
Telerik team
answered on 30 Jan 2018, 01:50 PM
Hello Simon,

I am afraid, that there is no built-in functionality to achieve the desired appearance. If you need to hide the 'Never' option for recurrence end, you could follow the example suggested previously in this thread.

Another suggestion is described in the following link from StackOverflow. For your convenience I prepared a Dojo example based on the sample code in the link. I hope you will find it helpful.

Regards,
Neli
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Simon
Top achievements
Rank 1
answered on 16 Feb 2018, 12:51 PM
Thanks Neli, works great.
0
Simon
Top achievements
Rank 1
answered on 08 Mar 2019, 07:38 PM

Neli, can you set the "After" radio button to be default selected after hiding the "Never" radio button for Daily/Weekly/Monthly/Yearly options? As it is now radio button is selected ("After or End") which confuses our users, they have been selecting neither radio button...

 

Thanks.

0
Dimitar
Telerik team
answered on 12 Mar 2019, 10:31 AM
Hello Simon,

You could achieve the desired result as follows:
function onRecurrenceEditor_Change(e, obj) {
  var buttonNever = obj._buttonNever;
  var buttonCount = obj._buttonCount;
       
  if (buttonNever) {
    $(buttonNever[0]).parent().remove();
  }
   
  if(buttonCount) {  
    buttonCount.parent().click();
  }
}

Here is an updated Dojo example that demonstrates the above.

Regards,
Dimitar
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.
Adnan
Top achievements
Rank 1
commented on 02 Jun 2023, 07:20 AM

I checked its hide never button but I'm getting one more issue now. its keep selected "After" radio button   but keep disable ..its count until I click on radio button again.

and even when I click on "On" radio still its keep selected "After" radio button.

Anton Mironov
Telerik team
commented on 06 Jun 2023, 06:24 AM

Hi Adnan,

Thank you for the image provided.

Could you please share more details on the issue and the replication steps?

The fastest route to getting you up and running is if you could provide a runnable, isolated, sample project. Examining this project will let us replicate the issue locally and further troubleshoot it.

Looking forward to hearing back from you.

Kind Regards,
Anton Mironov

 

Tags
Scheduler
Asked by
Pär Sandgren
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Pär Sandgren
Top achievements
Rank 1
Simon
Top achievements
Rank 1
Neli
Telerik team
Dimitar
Telerik team
Share this question
or