|
[Index.cshtml]
function dataBound() {
var previousData = null;
var stRowIndex = null;
var endRowIndex = null;
var grid = this;
var rows = this.getRows();
var data = this.getCurrentViewRecords();
for (var i = 0, len = rows.length; i < len; i++) {
if (!previousData) {
previousData = data[i]['OrderID'];
stRowIndex = parseInt(rows[i].getAttribute("aria-rowindex"));
}
else if (previousData === data[i]['OrderID']) {
rows[i].children[0].classList.add('e-hide');
}
else if (previousData && previousData !== data[i]['OrderID']) {
if (this.getRows().length > 0 && this.getRows().length > stRowIndex) {
endRowIndex = parseInt(rows[i].getAttribute("aria-rowindex"), 10);
var targetCell =
[].slice.call(this.getRows()[stRowIndex].querySelectorAll('.e-rowcell')).filter((cell) =>
parseInt(cell.getAttribute('aria-colindex'), 10) === parseInt(rows[i].children[0].getAttribute('aria-colindex')));
targetCell[0].setAttribute("rowSpan", endRowIndex - stRowIndex);
previousData = data[i]['OrderID'];
stRowIndex = parseInt(rows[i].getAttribute("aria-rowindex"), 10);
}
}
if (rows[i].children[0].classList.contains("e-hide") || i < len) {
endRowIndex = parseInt(rows[i].getAttribute("aria-rowindex"), 10);
if (endRowIndex > 0) {
var targetCell = [].slice.call(this.getRows()[stRowIndex].querySelectorAll('.e-rowcell')).filter((cell) =>
parseInt(cell.getAttribute('aria-colindex'), 10) === parseInt(rows[i].children[0].getAttribute('aria-colindex')));
targetCell[0].setAttribute("rowSpan", endRowIndex + 1);
}
}
}
} |