Jack
Jack

Reputation: 1

How to add Checkbox to Kendo Grid's Toolbar?

I want to add a checkbox to the Toolbar of a Kendo Grid, but there is no configuration or sample on the Documentation. So, is it possible to add checkbox as button?

<script>
    var grid = $("#grid").kendoGrid({
        toolbar: [
            { name: 'excel', text: 'Export to Excel' },
            { type: 'checkbox', text: 'Get full list', id: "cbFull" } //it does not work
        ]
    //code omitted for brevity
<script>

Upvotes: 0

Views: 3623

Answers (1)

ASG
ASG

Reputation: 955

<script type="text/x-kendo-template" id="template">
   <div class="toolbar">
      <input type="button" id="exportExcel" value="Export Excel"/>
      <label class="list-label" for="list">Get full list:</label>
      <input type="checkbox" id="list" style="width: 75px"/>
   </div>
</script>

<script>
 $(document).ready(function() {
 var grid = $("#grid").kendoGrid({
 toolbar: kendo.template($("#template").html())
 //code omitted for brevity

 var excelButton = grid.find("#exportExcel")
 excelButton.on("click",function(){
     alert("Saving...");
     grid.data("kendoGrid").saveAsExcel();
  });
});
</script>

Example http://dojo.telerik.com/iFodO (Export doesn't actually work as its missing JSZip)

Upvotes: 1

Related Questions