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

Custom Toolbar buttons

3 Answers 411 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Fabio
Top achievements
Rank 1
Fabio asked on 03 Sep 2012, 04:11 PM
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

3 Answers, 1 is accepted

Sort by
0
Kumara
Top achievements
Rank 1
answered on 04 Sep 2012, 05:40 PM
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
0
OnaBai
Top achievements
Rank 2
answered on 04 Sep 2012, 10:34 PM
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.

0
Fabio
Top achievements
Rank 1
answered on 05 Sep 2012, 08:11 AM
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!
Tags
Grid
Asked by
Fabio
Top achievements
Rank 1
Answers by
Kumara
Top achievements
Rank 1
OnaBai
Top achievements
Rank 2
Fabio
Top achievements
Rank 1
Share this question
or