Kendo Treelist imageClass不再受支持

时间:2018-10-02 12:07:05

标签: javascript kendo-ui icons kendo-treelist

对于TreeLIST,我需要imageClass的新等效项,或者需要向树列表“工具栏”按钮添加图标的任何其他可能性

1 个答案:

答案 0 :(得分:0)

toolbar接受模板,因此您可以自定义整个工具栏。不利的一面是,您需要为每个按钮编写整个HTML并处理其所有事件。不过,这是另一种选择。示例:

  $("#treeList").kendoTreeList({
    toolbar: '<button type="button" data-command="custom" class="k-button k-button-icontext about-button"><span class="k-icon k-i-info"></span>About</button>',
    columns: [
      "lastName",
      "position"
    ],
    dataSource: [
      { id: 1, parentId: null, lastName: "Jackson", position: "CEO" },
      { id: 2, parentId: 1, lastName: "Weber", position: "  VP, Engineering" }
    ]
  });
  
  $("#treeList").on("click", "button.about-button", function() {
    console.log("About button clicked");
  });
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script><script src="https://kendo.cdn.telerik.com/2018.3.911/js/kendo.all.min.js"></script>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.3.911/styles/kendo.common.min.css"/>
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.3.911/styles/kendo.rtl.min.css"/>
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.3.911/styles/kendo.silver.min.css"/>
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.3.911/styles/kendo.mobile.all.min.css"/>
    
<div id="treeList"></div>