Conditional rowgrouping. Do not group when there is only one row.

Conditional rowgrouping. Do not group when there is only one row.

vishal7488vishal7488 Posts: 13Questions: 5Answers: 0

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%";>&nbsp;</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

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    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 in drawCallback, and scan the table there and hide any headers with that single row.

    Colin

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    Answer ✓

    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

  • vishal7488vishal7488 Posts: 13Questions: 5Answers: 0

    Thanks for the response Colin

This discussion has been closed.