Multiple THEAD Row, All TH

Multiple THEAD Row, All TH

TheJester1977TheJester1977 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">&nbsp;ID&nbsp;</th>
                    <th class="th">&nbsp;Year&nbsp;</th>
                    <th class="th">&nbsp;Language&nbsp;</th>
                    <th class="th">&nbsp;Title&nbsp;</th>
                </tr>
                <tr style="text-align: center">
                    <th class="th">&nbsp;Qty On Hand&nbsp;</th>
                    <th class="th">&nbsp;Last Modified&nbsp;</th>
                    <th class="th">&nbsp;Last Mod By&nbsp;</th>
                    <th class="th">&nbsp;Last Mod Reason&nbsp;</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

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    You need to use colspan for complex headers.

    http://datatables.net/examples/basic_init/complex_header.html

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    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

  • TheJester1977TheJester1977 Posts: 6Questions: 1Answers: 0

    You bet, I'll build it right now...

  • TheJester1977TheJester1977 Posts: 6Questions: 1Answers: 0

    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!!

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Looks like it just missing a style:

    thead tr:first-child {
      border-bottom: 1px solid black;
    }
    

    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

  • TheJester1977TheJester1977 Posts: 6Questions: 1Answers: 0

    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!!

  • TheJester1977TheJester1977 Posts: 6Questions: 1Answers: 0

    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!

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    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

  • TheJester1977TheJester1977 Posts: 6Questions: 1Answers: 0

    Bummer... thanks allan!

This discussion has been closed.