How I can rowspan kendo grid ui

≡放荡痞女 提交于 2020-01-05 07:55:09

问题


I want rowspan in gird kendo ui like this picture ? Images example Thanks so much!


回答1:


Row spanning implies one of the following:

  • that you will have access to at least two data items for a single table row element in a column or a row template, during rendering. This, unfortunately, is not possible with the Kendo UI Grid.
  • even if you manipulate the table structure in the Grid's dataBound event, the Grid will not be aware of this and some operations will not work correctly (e.g. editing, selection, data item retrieval, etc.)

As a result, row spanning is not supported.




回答2:


With me, use rowTemplate:

var index = 0;
$("#grid").kendoGrid({
  columns: [{
    title: "Name + Age", 
    columns: [{title: "Name"}, {title: "Age"}]
  }],
  dataSource: [ 
    { name: "Jane Doe", age: 30 }, 
    { name: "Jane Doe", age: 30 }, 
    { name: "Jane Doe", age: 30 }, 
    { name: "Jane Doe", age: 30 }, 
    { name: "Jane Doe", age: 30 }, 
    { name: "John Doe", age: 33 } 
  ],
  rowTemplate: 
  '<tr> '+
    '#if(index++ % 3 == 0){# '+
        '<td rowspan=3><strong>#=name#</strong></td> '+
    '#}#   '+
    '<td><strong>#: age #</strong></td>'+
  '</tr>'
});
</script>


来源:https://stackoverflow.com/questions/43632868/how-i-can-rowspan-kendo-grid-ui

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