When I popup a recurrence event, it does not go back to the server where I have logic that is based on the start date before current date.
How do I manipulate the Model that it creates from a recurrence event so that I can hide things based on the start date in my custom template?
in my model I have isPassed but this is based on the first in the series and not the current event..
4 Answers, 1 is accepted

I tried this:
Scheduler added an event edit handler:
.Editable(editable =>
{
editable.TemplateName("CustomEditorTemplate");
})
.Events(e => e.Edit("edit_handler"))
function edit_handler(e) {
var dt = new Date();
e.event.CanLog = e.event.Start < dt;
};
The value is changed in the data when I view it, but it does not seem to affect my template:
If canlog is false I still see this:
# if(CanLog){ #
<div class="k-edit-label">
@(Html.LabelFor(model => model.Title))
</div>
<div data-container-for="title" class="k-edit-field">
@(Html.TextBoxFor(model => model.Title, new { @class = "k-textbox", @readonly = "readonly", data_bind = "value:title" }))
</div>
#}else{#
Does the template get rendered before the edit event is called?

Changed edit_handler:
function edit_handler(e) {
var dt = new Date();
var canLog = e.event.Start < dt;
e.event.set("CanLog", canLog);
};
Again I see the data changed, but it is not working in the custom view.
Indeed, the editor template is rendered before edit event is triggered. This is done to ensure that the required HTML is available before bind the form to the edited event.
If you would like to show/hide some parts of the editor, then you can do that easily using jQuery. Instead of using if/else logic, just wrap the HTML in div elements that you can show/hide. Once this is done, you can find the relevant elements and show/hide them accordingly:
function
edit_handler(e) {
//look in e.container.
}
Regards,
Georgi Krustev
Telerik
