Using a custom template for a custom button on kendo ui editor

2 posts, 0 answers
  1. SupportTI
    SupportTI avatar
    8 posts
    Member since:
    Feb 2010

    Posted 17 Jul 2015 Link to this post

    I'm trying to create a custom button for the kendo ui editor. The button works fine except when I try to use a custom template.
    Here's the code for my custom button:

    var currentDateAction = {
        name: 'currentDate',
        tooltip: vm.TemplateLetterCurrentDateLabel(),
        template: '<button class="k-button">' + vm.TemplateLetterCurrentDateLabel() + '</button>',
        exec: function () {
            var editor = $(this).data('kendoEditor');
            editor.exec('inserthtml', { value: vm.TemplateLetterCurrentDate() });

    If I comment the template line, the button works, otherwise it doesn't.
    What do I have to do, to have a custom template for my button?

  2. Iliana Nikolova
    Iliana Nikolova avatar
    2622 posts

    Posted 21 Jul 2015 Link to this post


    When using a template you should attach a click handler to the button manually and use the handler function instead of exec. For example: 
        tools: [{
           name: 'currentDate',
           template: '<button class="k-button" onclick="buttonClick()">currentDate</button>',
    function buttonClick(){

    Iliana Nikolova
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top