Hi
I have a simple Kendo Scheduler Demo: http://dojo.telerik.com/IqIYI/7
In this demo I have a custom edit template defined as follows:
<script id="editor" type="text/x-kendo-template">
<h3>Edit meeting</h3>
<p>
<label>Title: <input name="title" /></label>
</p>
<p>
<label>Start: <input data-role="datetimepicker" name="start" /></label>
</p>
<p>
<label>End: <input data-role="datetimepicker" name="end" /></label>
</p>
</script>
This template has 2 buttons in create-new-mode and 3 buttons when in edit-mode by default.
I am now trying to add a 4th button to the edit popup and then catch its click event and do something else (create a new popup filled with the one of the event - functionality of "edit as new").
I am adding this button through the edit event of kendo in the case of an edit of an actual event (fired whenever the popup template loads).
edit: function(e) {
if (!e.event.isNew()) {
$(".k-edit-buttons.k-state-default").prepend('<a class="k-button" id="editasnew">Edit as New</a>');
}
},
The button has an id="editasnew", and then a click event catcher:
$('#editasnew').click(function(){
console.log("edit now");
var scheduler = $("#scheduler").data("kendoScheduler");
scheduler.cancelEvent();
setTimeout(function(){
console.log("add new event now");
scheduler.addEvent({ title: "(No title)" });
}, 2000);
});
But! the click event is never fired.
So I wonder, is there a way to add the button a different way? (parameters through a kendo function - i did not find that in the documentation)
..or maybe restructure the click event catcher (maybe clicking this button has some stoppropagation function given by kendo)?
Any help appreciated!
I have a simple Kendo Scheduler Demo: http://dojo.telerik.com/IqIYI/7
In this demo I have a custom edit template defined as follows:
<script id="editor" type="text/x-kendo-template">
<h3>Edit meeting</h3>
<p>
<label>Title: <input name="title" /></label>
</p>
<p>
<label>Start: <input data-role="datetimepicker" name="start" /></label>
</p>
<p>
<label>End: <input data-role="datetimepicker" name="end" /></label>
</p>
</script>
This template has 2 buttons in create-new-mode and 3 buttons when in edit-mode by default.
I am now trying to add a 4th button to the edit popup and then catch its click event and do something else (create a new popup filled with the one of the event - functionality of "edit as new").
I am adding this button through the edit event of kendo in the case of an edit of an actual event (fired whenever the popup template loads).
edit: function(e) {
if (!e.event.isNew()) {
$(".k-edit-buttons.k-state-default").prepend('<a class="k-button" id="editasnew">Edit as New</a>');
}
},
The button has an id="editasnew", and then a click event catcher:
$('#editasnew').click(function(){
console.log("edit now");
var scheduler = $("#scheduler").data("kendoScheduler");
scheduler.cancelEvent();
setTimeout(function(){
console.log("add new event now");
scheduler.addEvent({ title: "(No title)" });
}, 2000);
});
But! the click event is never fired.
So I wonder, is there a way to add the button a different way? (parameters through a kendo function - i did not find that in the documentation)
..or maybe restructure the click event catcher (maybe clicking this button has some stoppropagation function given by kendo)?
Any help appreciated!