无法在Kendogrid中添加2个工具栏?

时间:2014-12-18 09:30:28

标签: jquery kendo-grid kendo-asp.net-mvc

我已经有一个用于过滤网格的工具栏。

我还需要一个excel工具栏。两者都应该在网格的标题上。

var grid = $("#grid_View").kendoGrid({
           dataSource: datasource,
           selectable: "row",
           sortable: true, editable: false,
           toolbar: kendo.template($("#filterTemplate").html()),
           toolbar: ["excel"],
           excel: {
               fileName: "LogExport.xls",
               filterable: true
           },

过滤器模板位于网格html中:

<script type="text/x-kendo-template" id="filterTemplate">
            <div class="toolbar">
                <label  id="fromRange"></label>
                <label>@CommonResource.From</label>
                <label id="logFromDate"></label>
                <label>@CommonResource.To</label>
                <label id="logToDate"></label>

                <input type="search" id="events" />
            </div>
        </script>

1 个答案:

答案 0 :(得分:1)

在&#34; filterTemplate&#34;

中添加您的Excel模板
<script type="text/x-kendo-template" id="filterTemplate">
  <div class="toolbar">
    <a class="k-button k-button-icontext k-grid-pdf" href="\\#">
        <span class=" ">
        </span>pdf
    </a>
    <a class="k-button k-button-icontext k-grid-excel" href="\\#">
        <span class=" ">
        </span>excel
    </a>
    <a class="k-button k-button-icontext k-grid-add" href="\\#">
        <span class="k-icon k-add">
        </span>Add new record
    </a>
    <label  id="fromRange"></label>
    <label>@CommonResource.From</label>
    <label id="logFromDate"></label>
    <label>@CommonResource.To</label>
    <label id="logToDate"></label>

    <input type="search" id="events" />
  </div>
</script>