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

Kendo Scheduler additional button in custom edit popup template

1 Answer 573 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Markus
Top achievements
Rank 1
Markus asked on 02 Mar 2015, 12:18 PM
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!

1 Answer, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 02 Mar 2015, 01:36 PM
Hi,

It seems like the click event was not added corrected. Here is the code where the click event was thrown correctly  are my side- http://dojo.telerik.com/IqIYI/19.

Hope this will be helpful.

Regards,
Plamen
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Scheduler
Asked by
Markus
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Share this question
or