COLSPAN
attribute for a cell in table body.Plugin requires jQuery DataTables version 1.10 or above. According to the author’s post on DataTables forum, this plugin has the following features:
- supports nested multi grouping rows
- supports both client-side and server-side processing
- correctly handles single-column and multi-column ordering
To use the plugin, you need to include JavaScript file dataTables.rowsGroup.js
and use rowsGroup
option as shown below. Option rowsGroup
should be an array of the column selectors in order you want the grouping to be applied.
var table = $('#example').DataTable({
'rowsGroup': [2]
});
More details on usage can be found on plugin’s project page.
A great example Michael!
I have an issue though with the rowreorder being applied with this plugin. Row reorder works just fine for rows within the rowspan except if first row in the row group is to be swapped with any otehr row of the row group.
Below is the live example of the same :
http://live.datatables.net/nowamowi/1/edit
Could you please help me out on this? I need to be able to drag-drop all the rows of the row group.
Hi this one very much useful for me, unfortunately while using
'rowsGroup': [0]
is not working properly can you give some idea about the issue.In the example shown in the article first column contains unique data. If you use
'rowsGroup': [0]
, it will have no effect because no ROWSPAN will be applied.Hi Michael Ryvkin, Thanks for knowledge sharing. This is very much helpful for us. I have one small question on this, it’ll be great and much more appreciated if you answered it asap you can.
What if we need to define multiple rowsGroup?
Explanation: In the above example you grouped all the rows with the column
Office
location, in the same way what if I need to group the rows byPosition
?. Hope I am clear about my question!!Done. Got it.. Here’s the answer
Glad that you figured it out. Keep in mind that the order is important so that
'rowsGroup': [1, 2]
will first group by position and then by city, and'rowsGroup': [1, 2]
will first group by city and then by position.Hi Michael Ryvkin, Thanks for knowledge sharing. This is very much helpful for us. I have one small question on this. When exporting to excel or pdf the result shows normal table with out grouping can you help me to sort out this problem ?
Thanks and Best Regards
I assume this is not possible using standard pdfHtml5 and excelHtml5 buttons. According to the official documentation you may be able to create a new button based on the default one and tweak the produced document, but most likely there would be a lot of code required.
Hi Michael Ryvkin, Thanks for knowledge sharing. This is very much helpful for us.
But I’ve a case here,
This solutions is working nice when I load js libraries by external link. But if I load it by internal it not working anymore.
Does that libraries must loaded by external link?
(https://cdn.rawgit.com/ashl1/datatables-rowsgroup/fbd569b8768155c7a9a62568e66a64115887d7d0/dataTables.rowsGroup.js)
Thankyou
I have already merged row if values are same. Can you guide me how can I show or hide column of merged cell data-tables?
Hello, The pagination is not working when I am using rowsGroup plugin, what must be the reason ?
There could be multiple reasons depending on your implementation. Could you please share an example or link to the page demonstrating the problem?