Custom Toolbar buttons

4 posts, 0 answers
  1. Fabio
    Fabio avatar
    2 posts
    Member since:
    Aug 2012

    Posted 03 Sep 2012 Link to this post

    Hi,
    i need to add some new button on toolbar. 

    I try to define a toolbar options like this

      toolbar: [{name:"Nuova Attività",  imageClass: "k-icon k-add" },
                   { name: "Ricerca", className: "k-grid-ricerca", imageClass: "k-icon k-i-search" },
                   { template: $j("#Toolbar").html() } 
    ],

    ....and the script template:

        <script type="text/x-kendo-template" id="Toolbar">    
    <form id="frmSearch" name="frmSearch" style="display:none">
    <label class="nome-label" for="nome">Nome:</label>
    <input type="nome" id="nome" style="width: 130px"></input>
    </form> 
        </script>

    i try to select the custom class k-grid-ricerca but it doesn't work.

    $j(".k-grid-ricerca").click(function(){
    alert("hello");
    });

    do you have some solutions? Thanks
  2. Kumara
    Kumara avatar
    2 posts
    Member since:
    Sep 2012

    Posted 04 Sep 2012 Link to this post

    How about it,  i dont know whether it is right or wrong.
    function Hi()
    {
    alert("psst");
    }
    
    var buttonnode= document.createElement('input');
    buttonnode.setAttribute('type','button');
    buttonnode.setAttribute('name','sal');
    buttonnode.setAttribute('value','sal');
    cell1.appendChild(buttonnode);
    
    //New Part here
    buttonnode.onClick = Hi;

    Click here if it is wrong Electrical contractors
  3. Kendo UI is VS 2017 Ready
  4. OnaBai
    OnaBai avatar
    55 posts
    Member since:
    Aug 2012

    Posted 04 Sep 2012 Link to this post

    I've tried what you did and it works BUT I'm still not sure about what are you trying to get with a button in the toolbar where you only have a template (third button).
    The part of defining two custom buttons and associating the alert("hello") to the "Ricerca" button is fine but if the form defined in the template should be some sort of popup window, there is some code missing.

  5. Fabio
    Fabio avatar
    2 posts
    Member since:
    Aug 2012

    Posted 05 Sep 2012 Link to this post

    i've found a solution. 

    The problem it was jquery. i've put the selector of css class outside the $(function(){.....}) and it doesn't work. After put it inside it's work correctly. 

    $(function(){
     
    ......kendo stuff....
     
    $j(".k-grid-ricerca").click(function(){
            alert("hello");
        });
    });


    Thanks!
Back to Top
Kendo UI is VS 2017 Ready