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