Multiple THEAD Row, All TH
Multiple THEAD Row, All TH
TheJester1977
Posts: 6Questions: 1Answers: 0
Good morning all. Only found this AMAZING tool yesterday and already totally love it!! I think I am having a newbie issue, however. I have a THEAD that looks like this:
<thead>
<tr style="text-align: center">
<th class="th"> ID </th>
<th class="th"> Year </th>
<th class="th"> Language </th>
<th class="th"> Title </th>
</tr>
<tr style="text-align: center">
<th class="th"> Qty On Hand </th>
<th class="th"> Last Modified </th>
<th class="th"> Last Mod By </th>
<th class="th"> Last Mod Reason </th>
</tr>
</thead>
Without DataTables applied to it, it looks like this:
+------------------+------------------+------------------+------------------+
| ID | Year | Language | Title |
+------------------+------------------+------------------+------------------+
| Qty On Hand | Last Modified | Last Mod By | Last Mod Reason |
+------------------+------------------+------------------+------------------+
When I retrofit DataTables onto the page, my TBODY gets squashed from 2 rows per result to 1. Any thoughts as to why?
Thanks!!
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You need to use colspan for complex headers.
http://datatables.net/examples/basic_init/complex_header.html
It appears to work fine for me: http://live.datatables.net/jowawepi/1/edit .
Can you link to a test case showing the issue please.
Allan
You bet, I'll build it right now...
OK, so I built it out... first, the link:
http://live.datatables.net/budozula/1/edit
Screenshot of what DataTables to my live site at http://www.familypages.net/civey/CHAIRS_PostDataTable.png and 100 entries (more complete view) at http://www.familypages.net/civey/CHAIRS_PostDataTable100.png
Also, the output is sorted wrong from the get-go. I posted a screenshot of what it's supposed to look like at http://www.familypages.net/civey/CHAIRS_PreDataTable.png
Thanks for looking into this!!
Looks like it just missing a style:
http://live.datatables.net/budozula/2/edit
The sorting in your example looks fine. There are 6 rows which are sorted numerically 0, 0, 0, 1, 2, 3. Do you want it sorted not numerically?
Allan
I think the issue here I have 2 rows of data that make up one record - an 8 column record folded in half, essesntially. In my "CHAIRS_PreDataTable" PNG, the 2 blue rows on top represent 1 data record (8 fields, as delineated in the table header), then the 2 white rows are record #2, 2 blues under them are record 3, etc. The default sort should be "ID", the top-left header box. So just looking at the left column, it should read:
1
0
2
0
3
0
4
0
etc...
When someone updates the "Qty On Hand" number, let's say for record 2, it would read like:
1
0
2
90
3
0
4
0
etc
The 2 rows of data that form one record should stay together through each change in table formatting. So if I were to sort by "Qty On Hand" DESC above, it would become:
2
90
1
0
3
0
4
0
etc
Is what I'm asking about even possible?
Thanks again!!
Anyone know? This kind of layout is used frequently in my site, and it would be very helpful if it could work as requested. :o)
Thanks!
Thanks for the clarification - I understand now. Unfortunately, no, this is not currently possible in DataTables. The rows are 100% independent from each other and therefore two cannot be grouped together. That is a feature I would like to add in future, but it isn't available at the moment.
Allan
Bummer... thanks allan!