Kendo Scheduler additional button in custom edit popup template

2 posts, 0 answers
  1. Markus
    Markus avatar
    71 posts
    Member since:
    Jan 2015

    Posted 02 Mar 2015 Link to this post

    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!
  2. Plamen
    Admin
    Plamen avatar
    2958 posts

    Posted 02 Mar 2015 Link to this post

    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!
     
Back to Top