How do I set the groupHeaderTemplate for Kendo Grid column using data attributes? -


i want able take advantage of data attributes handle configuring grid, can't figure out how set groupheadertemplate column.

the documentation suggests use data-group-header-template: http://docs.kendoui.com/getting-started/data-attribute-initialization

<table id="grid"     data-role="grid"     data-bind="source: datasource">   <thead>     <tr>       <th          data-field="id"         data-group-header-template="t_name">id</th> <!-- doesn't work! :( -->       </tr>   </head> </table>  <script>   kendo.bind($('body'), viewmodel); </script> 

how set group header template on column without directly calling $.fn.kendogrid?

update:

i checked source code kendo grid, , doesn't seem set properties defined on columns.

for reference, in grid._columns...

// using html5 data attributes configuration option return {   field: field,   type: type,   sortable: sortable !== "false",   filterable: filterable !== "false",   groupable: groupable !== "false",   menu: menu,   template: th.attr(kendo.attr("template")),   width: cols.eq(idx).css("width") }; 

later, when writing group row html in grid._grouprowhtml

template = column.groupheadertemplate; // wasn't set in _columns. :( if (template) {     text  = typeof template === function ? template(data) : kendo.template(template)(data); } 

you using correctly. contents of attribute should refer id of script element containing kendo template.

<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> 

you need have called kendo.bind, passing in element above table in dom hierarchy.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -