grouping doesn't work
grouping doesn't work
Hello,
I'm trying to implement grouping on my DataTable. I found an example of how to do that here:
https://datatables.net/examples/advanced_init/row_grouping.html
However, it's not working for me.
Here's my code:
[code]
column 1 | column 2 |
---|---|
A | Z |
A | Z |
B | Y |
B | Y |
B | Y |
C | X |
C | X |
I'm expecting it to group by column 1. So all the A's would be a group, all the B's would be a group, and all the C's would be a group.
The Chrome debugger shows that it's not entering the "drawCallback" event handler. It also shows that it doesn't enter the onClick function when I click anywhere on the table.
Can anyone see what I'm doing wrong? Thanks.
PS - Sorry, I do not have access to my server right and can't upload an example for you to try.
This question has an accepted answers - jump to answer
Answers
IT would be best if you can build an example for us.
Also this forum uses different (not
[code]
) markup to display the code. Here are the instructions:https://datatables.net/manual/tech-notes/8
Kevin
Thanks Kevin,
The best I can do is upload this example zip file. I don't have access to a public server right now. Hope you can do something with this.
Looks like the problem is this config option:
{ "visible": false, "targets": 2 }
There is no column 2. I think you should see some sort of error in the browser's console. Columns start counting at 0. You probably want to change it to:
{ "visible": false, "targets": 1 }
BTW, you can quickly post these types of code snippets on the DataTables JS Bin site:
https://datatables.net/manual/tech-notes/9
Kevin
Cool, thanks Kevin. That worked.