Is it possible to group based on data attribute (such as data-group="subgroup1") like that.
My requirement is to hide the group data on data attribute and show a different text on table cell, thanks
Is it possible to group based on data attribute (such as data-group="subgroup1")
Would you have an attribute per cell? Or per row. Either way, at the moment it isn't possible, but it something like something that might be worth exploring as an option if you could provide more information about how to plan to use it. Until then, you'd need to use rowGroup.dataSrc to point to somewhere in the data source object that contains the grouping information.
How to add border after merged row completed
Can you show me a mock up picture of what you mean please?
It works like a charm.
But there's one issue.
I am using rowGroup also to summarize group totals at the bottom.
the issue is in endRender function of rowGroup.
It puts <td> of totals with colspan twice when the page loads first time..
Please help me out.
Example:
$('#myTable').DataTable
(
[bla bla bla]
rowsGroup:[0,1],
rowGroup:
{
startRender:null,
endRender:function(rows,group)
{
var tQty = rows
.data()
.pluck(3)
.reduce(function (a, b)
{
return a + b.replace(/[^\d]/g, '') * 1;
}, 0) ;
return $('<tr/>')
.append('<td colspan="3" align="left" class="grpApplied" >' + group + '- Total: ' + '</td>')
.append('<td align="right">' + tQty + '</td>')
}
},
dataSrc:[0]
);
Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Replies
This thread is specifically concerned with the RowGroup feature. Is that what you need?
Is it possible to group based on data attribute (such as data-group="subgroup1") like that.
My requirement is to hide the group data on data attribute and show a different text on table cell, thanks
No, HTML5 data attributes aren't currently supported.
Hi
How to add border after merged row completed
Would you have an attribute per cell? Or per row. Either way, at the moment it isn't possible, but it something like something that might be worth exploring as an option if you could provide more information about how to plan to use it. Until then, you'd need to use
rowGroup.dataSrc
to point to somewhere in the data source object that contains the grouping information.Can you show me a mock up picture of what you mean please?
Allan
It works like a charm.
But there's one issue.
I am using rowGroup also to summarize group totals at the bottom.
the issue is in endRender function of rowGroup.
It puts <td> of totals with colspan twice when the page loads first time..
Please help me out.
Example:
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
when page loads first time, it shows two rows of totals comes because of endRender.
when User Searches, it shows only once.
Thank you for sharing. This is very helpful for me.
works perfectly ! thanks !