Multi-column Headers With Kendo Grid

孤人 提交于 2019-12-05 18:04:01
D_Learning

You won't be able to achieve multirow Group headers via Kendo grid on MVC, although there were discussion to add the feature in the current version(2014Q2) of Kendo. See below link for more reference:
Pivot Grid StackOverflow Reference

However, you can achieve the multirow header option via jquery on databound event of the grid. But it is a workaround rather than a perfect soultion.
Please see the js function for databound event to add multirow header:

 function onDataBound(arg) {
     var myElem = document.getElementById('trParentHeader'); //Check if Parent Header Group exist
     if (myElem == null){ // if parent Header doesnot exist then add the Parent Header
        $("#grid").find("th.k-header").parent().before("<tr id='trParentHeader'>  <th colspan='2' class='k-header'><strong>Products + Unit Price</strong></th>  <th scope='col' class='k-header'><strong>Single Units in Stock</strong></th></tr>");
     }
  }

For more understanding and a working example please see below Sample:

MultiRow-Column Header Sample

Please let me know if you if you have any queries.

This is now natively supported by the Kendo grid. Here's an example.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!