kendo ui treelist - 设置单元格模板

时间:2015-06-30 01:24:11

标签: jquery kendo-ui kendo-grid

我想在Kendo TreeList的每个单元格中设置一个范围,默认情况下我会在Kendo Grid中获取此范围,但我无法在Kendo TreeList

中设置此范围

Kendo Grid:

    <td role="gridcell" title="Control Box">
          <span ng-bind="dataItem.partdesc" class="ng-binding">Control Box</span>    
    </td>

Kendo TreeList:

    <td role="gridcell" title="Control Box"></td>

1 个答案:

答案 0 :(得分:0)

我建议你两个解决方法,首先你可以使用列模板(但是你必须修改所有列,如果你希望每个单元格都像你描述的那样具有跨度),例如

$("#treelist").kendoTreeList({
  columns: [ {
    field: "name",
    template: "<span class='Test'>#:name#</span> "
  }],
  dataSource: [ { name: "Jane Doe" }, { name: "John Doe" } ]
});
  

DEMO

或者您可以在数据绑定上插入范围,例如

$("#treeList").kendoTreeList({
      columns: [
        { field: "Name" },
        { field: "Position" }
      ],
      dataSource: [
        { id: 1, Name: "Daryl Sweeney", Position: "CEO", parentId: null },
        { id: 2, Name: "Guy Wooten", Position: "Chief Technical Officer", parentId: 1 }
      ],
      dataBound: function(e) {
        e.sender.table.find("td[role='gridcell']").append("<span class='test'>Test</span>");
      }
 });
  

DEMO