Kendo ui 如何使用数据属性设置剑道网格列的groupHeaderTemplate?

Kendo ui 如何使用数据属性设置剑道网格列的groupHeaderTemplate?,kendo-ui,kendo-grid,Kendo Ui,Kendo Grid,我希望能够利用数据属性来处理配置我的网格,但不知道如何为列设置groupHeaderTemplate 文档建议我使用数据组标题模板: 稍后,在网格中写入组行html时。\u groupRowHtml template = column.groupHeaderTemplate; // Wasn't set in _columns. :( if (template) { text = typeof template === FUNCTION ? template(data) : kendo

我希望能够利用数据属性来处理配置我的网格,但不知道如何为列设置
groupHeaderTemplate

文档建议我使用
数据组标题模板

稍后,在
网格中写入组行html时。\u groupRowHtml

template = column.groupHeaderTemplate; // Wasn't set in _columns. :(
if (template) {
    text  = typeof template === FUNCTION ? template(data) : kendo.template(template)(data);
}

你正确地使用了它。但是,属性的内容应该引用包含剑道模板的脚本元素的id

<script id="myscriptname" type="text/x-kendo-template>
    <!--script markup/code here-->
</script>

<table id="grid"
    data-role="grid"
    data-bind="source: dataSource">
  <thead>
    <tr>
      <th 
        data-field="ID"
            data-group-header-template="myscriptname">ID</th>
      </tr>
  </head>
</table>

我指的是模板id,但我没有将其包含在示例中。它仍然不起作用,使用字符串模板也不起作用:。我检查了剑道网格源代码,它似乎没有从任何HTML定义的列映射页眉或页脚模板;它只映射
模板
属性。
template = column.groupHeaderTemplate; // Wasn't set in _columns. :(
if (template) {
    text  = typeof template === FUNCTION ? template(data) : kendo.template(template)(data);
}
<script id="myscriptname" type="text/x-kendo-template>
    <!--script markup/code here-->
</script>

<table id="grid"
    data-role="grid"
    data-bind="source: dataSource">
  <thead>
    <tr>
      <th 
        data-field="ID"
            data-group-header-template="myscriptname">ID</th>
      </tr>
  </head>
</table>