Conditional rowgrouping. Do not group when there is only one row.
Conditional rowgrouping. Do not group when there is only one row.
I am using rowGroup extension to group the rows. However, it is grouping even when there is only one row.
How can I avoid the grouping and show the data in table as-is when there is only one row for the group condition.
order: [
[0, 'asc']
],
rowGroup: {
dataSrc: 'prodClas',
startRender: function (rows, group) {
return $('<tr/>')
.append('<td colspan="13"><b>' + group + '<span display:inline-block; style="margin-right: 77.8%";> </span><button type="button" style="margin-left:0px;height: 200x;height: 23px;" class="btn btn-primary delete" id="delete">Add Term</button> </td>')
.attr('data-name', group)
}
}
This question has an accepted answers - jump to answer
Answers
I've been trying to see if it's possible with
rowGroup.startRender
but I don't think the header row is inserted at that point, so can be hidden. You'll need do something I believe indrawCallback
, and scan the table there and hide any headers with that single row.Colin
I just tried that out of curiosity, and that doesn't work, as the RowGroup rendering still occurs after all the draw callbacks. I think this is wrong, or at least needs a mechanism to trigger once the rendering has completed. I've raised it internally (DD-1957 for my reference) and we'll report back here when there's an update.
Cheers,
Colin
Thanks for the response Colin