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

Adding preset buttons to toolbar template

3 Answers 220 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Johan
Top achievements
Rank 1
Johan asked on 03 May 2013, 08:29 AM
I have the following toolbar template:
<script type="text/x-kendo-template" id="template">
    <div class="toolbar" style="float: left">  
        <label class="customers-label" for="customers">Filter details by customer:</label>
        <input type="search" id="customers" style="width: 150px"/>
    </div>
    <div class="toolbar""> 
        <label class="shops-label" for="shops">Filter details by shop:</label>
        <input type="search" id="shops" style="width: 150px"/>
    </div>
</script>
I include it as follow in my grid:
rowTemplate: kendo.template($("#rowTemplate").html()),
But I also want the following buttons to be part of it:
toolbar: [{ name: "create" },{ name: "save" }, { name: "cancel" }],
How do I combine the 2, I have tried various ways, but to no avail. I also have a similar situation with the rowtemplate where I want to include the buttons for edit and destroy.

I have to add that I am pretty new to kendo and I looked at the available documentation but I cannot find an answer. Any help would be appreciated.

3 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 07 May 2013, 07:07 AM
Hi Johan,

Thank you for contacting us. The template defines whole structure (mark-up) of the toolbar/row.
This means that if a template is used, the Grid will not render automatically the default command buttons. In order to achieve that, you should include the buttons mark-up inside the toolbar/rowTemplate.

Please use the developer tools of your browser (Firebug, Chrome Dev Tools) to inspect and copy mark-up of the rendered buttons and add it in the template.

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Pete Smith
Top achievements
Rank 1
answered on 15 Apr 2016, 08:07 PM
I am trying to do the same thing and it works for the most part, but the save changes button is now double posting. Any ideas as to why that would be?
0
Dimo
Telerik team
answered on 20 Apr 2016, 06:18 AM
Hello Pete,

The button's click handler may be atttached two times (depending on the custom code), or the button's markup may be matching the Grid's native Save button's markup, so one click handler is attached by the custom code, and one by the Grid. Please verify and send a runnable example if further assistance is required.

Regards,
Dimo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Johan
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Pete Smith
Top achievements
Rank 1
Dimo
Telerik team
Share this question
or