Reputation: 4262
I need to create a custom click event that fires off an ajax call on a date entry within the Scheduler. (The "event" holds data I need to perform the ajax call). This part is easy enough.
The problem is that the "change event" triggers for anything and everything including selecting the different day, week and month views. Resulting in a rather annoying popup for every little click.
I need to find a way of knowing what was clicked, so that I only fire off the ajax call on actual date entry clicks. How would I go about doing that?
EDIT
The reason the event is fired for the day, week and month view clicks as well as a scheduled entry click is that when selecting a scheduled entry, that entry remains selected regardless of the view been clicked resulting in the "changed event" containing the same data for that selected scheduled entry.
So the solution is possibly to deselect the selected entry or know what clicked element triggered the event. If the event was triggered by clicking on the "day" view for example. Don't do the ajax call, if the event was triggered by a click on a scheduled event this Monday for example, then do the ajax call.
The function I am working with is here: http://docs.telerik.com/kendo-ui/api/web/scheduler#events-change
Upvotes: 1
Views: 3864
Reputation: 4262
Altho I would have preferred to use the event change functions. The solution is to use an "event template" instead that holds an anchor tag that can trigger the modal window and ajax call when clicked on:
<script id="event-template" type="text/x-kendo-template">
<a onclick="calendarCall(#: id #);">#: title #</a>
</script>
<script>
function calendarCall(id){
$("#modal").modal("toggle");
$.ajax({
url: 'someurl' + id,
success: function(data){
$("#modal .modal-body").html(data);
}
})
}
</script>
Upvotes: 1