Hello,
In my custom editortemplate I am checking which type of task/appoinment is being clicked on, so I am able to change the design of the editortemplate based on which type it is. Eg. I am using the "<div data-bind="visible: IsActivityAppointment">".
But how do I determine if it's a new event being created and set the editortemplate from that?
//Allan
4 Answers, 1 is accepted
Hi Alian,
I would suggest taking a look at the article from our documentation linked below regarding customizing the editor templates depending if the event is new or edited:
In case, for example, you need to open the popup edit window only for editing, you could subscribe to the edit event of the Scheduler and check if the event is new as demonstrated below:
edit: function (e) {
if (e.event.isNew()) {
e.preventDefault();
}
}
Here is a Dojo example where this is demonstrated.
I hope the provided suggestions will be helpful. Let me know in case you need additional assistance on the matter.
Regards,
Neli
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Hi Neli,
I tried that and at first glance it works. But when I am editing an existing event it "sees" that as a new event and therefore uses my isNew() template.
It only occurs when I click "Edit current occurence". When I click "Edit the series" it shows the correct template.
Do you have any suggestions?
I hope my explanation makes sense to you.
//Allan
Hi Allan,
In order to perform an additional check for the recurring events, you could also check for example the recurrenceId of the events. I used the provided example in my previous reply and modified the editor template slightly. Below you will find the modifications marked in yellow:
# if(data.recurrenceId !== null && data.recurrenceId <= 0){#
<div data-bind="visible: isNew">
<div class="k-edit-label"><label for="title">Title NEW NEW NEW</label></div>
<div data-container-for="title" class="k-edit-field">
<input type="text" class="k-textbox" name="title" required="required" data-bind="value:title">
</div>
</div>
# } else if (data.recurrenceId > 0) {#
<h4>The 'Title' field is hidden, because event is not new</h4>
# } #
Here is also the modified Dojo example.
I remain at your disposal for any further questions regarding the issue.
Regards,
Neli
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Thank you Neli.
I will have a look at that.
//Allan