When the table has more columns,table's head and body position are in disorder

When the table has more columns,table's head and body position are in disorder

heroadheroad Posts: 4Questions: 1Answers: 0
edited July 2014 in Free community support

what can Ido to make the table's head and the body be in line?

example:

$(document).ready(function() {
                $('#example').dataTable( {
                    "aaData": [[1,"20140709","123",1432.0,123.0,13353.0,"1122.00","1324.00","1342.00","1423.00","1432.00","130.00","145.00","222.00","1111.00","234.00","234.00","345.00","456.00","123.00","124.00","145.00","179.00","180.00","234.00","1111.00","1122.00","1324.00","1342.00","1423.00","1432.00","130.00","145.00","222.00","1111.00","234.00","234.00","345.00","456.00","123.00","124.00","145.00","179.00","180.00","234.00","1111.00","1122.00","1324.00","1342.00","1423.00","1432.00","130.00","145.00","222.00","1111.00","234.00","234.00","345.00","456.00","123.00","124.00","145.00","179.00","180.00","234.00","1111.00","1122.00","1324.00","1342.00","1423.00","1432.00","130.00","145.00","222.00","1111.00","234.00","234.00","345.00","456.00","123.00","124.00","145.00","179.00","180.00","234.00","1342.00","1423.00","1432.00","130.00","145.00","222.00","1111.00","234.00","234.00","345.00","456.00","123.00","124.00","145.00","179.00","180.00","234.00"],[2,"20140709","456",1432.0,123.0,18255.25,"1122.00","1111.00","1122.00","1111.00","1122.00","1111.00","1122.00","1111.00","1122.00","1111.00","1122.00","1111.00","1122.00","1111.00","1122.00","1111.00","1122.00","1111.00","1122.00","1111.00","1122.00","1111.00","1122.00","1111.00","1122.00","1111.00","1122.00","1111.00","1122.00","1111.00","1122.00","1111.00","1122.00","1111.00","1122.00","1111.00","1122.00","180.00","234.00","1111.00","1122.00","1324.00","1342.00","1423.00","1432.00","130.00","145.00","222.00","1111.00","234.00","234.00","345.00","456.00","123.00","124.00","145.00","179.00","180.00","234.00","1111.00","1122.00","1324.00","1342.00","1423.00","1432.00","130.00","145.00","222.00","1111.00","234.00","234.00","345.00","456.00","123.00","124.00","145.00","179.00","180.00","234.00","1342.00","1423.00","1432.00","130.00","145.00","222.00","1111.00","234.00","234.00","345.00","456.00","123.00","124.00","145.00","179.00","180.00","234.00"],[3,"20140709","789",2222222.0,123.0,576571.75,"2222.00","2222.00","2222.00","2222.00","2222.00","2222.00","2222.00","2222.00","2222.00","2222.00","2222.00","2222222.00","1122.00","1111.00","1122.00","1111.00","1122.00","1111.00","1122.00","1111.00","1122.00","1111.00","1122.00","1111.00","1122.00","1111.00","1122.00","1111.00","1122.00","1111.00","1122.00","1111.00","1122.00","1111.00","1122.00","1111.00","1122.00","180.00","234.00","1111.00","1122.00","1324.00","1342.00","1423.00","1432.00","130.00","145.00","222.00","1111.00","234.00","234.00","345.00","456.00","123.00","124.00","145.00","179.00","180.00","234.00","1111.00","1122.00","1324.00","1342.00","1423.00","1432.00","130.00","145.00","222.00","1111.00","234.00","234.00","345.00","456.00","123.00","124.00","145.00","179.00","180.00","234.00","1342.00","1423.00","1432.00","130.00","145.00","222.00","1111.00","234.00","234.00","345.00","456.00","123.00","124.00","145.00","179.00","180.00","234.00"]],
                    "sScrollX": "100%",
                    "sScrollXInner": "130%",
                    "bScrollCollapse": true
                } );
            } );

Page's table code:

<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
    <thead>
        <tr class="form_tr_first">
                            
                            
                                <th>Number</th>
                            
                                <th>Date</th>
                            
                                <th>column1</th>
                            
                                <th>column2</th>
                            
                                <th>column3</th>
                            
                                <th>column4</th>
                            
                                <th>00:15</th>
                            
                                <th>00:30</th>
                            
                                <th>00:45</th>
                            
                                <th>01:00</th>
                            
                                <th>01:15</th>
                            
                                <th>01:30</th>
                            
                                <th>01:45</th>
                            
                                <th>02:00</th>
                            
                                <th>02:15</th>
                            
                                <th>02:30</th>
                            
                                <th>02:45</th>
                            
                                <th>03:00</th>
                            
                                <th>03:15</th>
                            
                                <th>03:30</th>
                            
                                <th>03:45</th>
                            
                                <th>04:00</th>
                            
                                <th>04:15</th>
                            
                                <th>04:30</th>
                            
                                <th>04:45</th>
                            
                                <th>05:00</th>
                            
                                <th>05:15</th>
                            
                                <th>05:30</th>
                            
                                <th>05:45</th>
                            
                                <th>06:00</th>
                            
                                <th>06:15</th>
                            
                                <th>06:30</th>
                            
                                <th>06:45</th>
                            
                                <th>07:00</th>
                            
                                <th>07:15</th>
                            
                                <th>07:30</th>
                            
                                <th>07:45</th>
                            
                                <th>08:00</th>
                            
                                <th>08:15</th>
                            
                                <th>08:30</th>
                            
                                <th>08:45</th>
                            
                                <th>09:00</th>
                            
                                <th>09:15</th>
                            
                                <th>09:30</th>
                            
                                <th>09:45</th>
                            
                                <th>10:00</th>
                            
                                <th>10:15</th>
                            
                                <th>10:30</th>
                            
                                <th>10:45</th>
                            
                                <th>11:00</th>
                            
                                <th>11:15</th>
                            
                                <th>11:30</th>
                            
                                <th>11:45</th>
                            
                                <th>12:00</th>
                            
                                <th>12:15</th>
                            
                                <th>12:30</th>
                            
                                <th>12:45</th>
                            
                                <th>13:00</th>
                            
                                <th>13:15</th>
                            
                                <th>13:30</th>
                            
                                <th>13:45</th>
                            
                                <th>14:00</th>
                            
                                <th>14:15</th>
                            
                                <th>14:30</th>
                            
                                <th>14:45</th>
                            
                                <th>15:00</th>
                            
                                <th>15:15</th>
                            
                                <th>15:30</th>
                            
                                <th>15:45</th>
                            
                                <th>16:00</th>
                            
                                <th>16:15</th>
                            
                                <th>16:30</th>
                            
                                <th>16:45</th>
                            
                                <th>17:00</th>
                            
                                <th>17:15</th>
                            
                                <th>17:30</th>
                            
                                <th>17:45</th>
                            
                                <th>18:00</th>
                            
                                <th>18:15</th>
                            
                                <th>18:30</th>
                            
                                <th>18:45</th>
                            
                                <th>19:00</th>
                            
                                <th>19:15</th>
                            
                                <th>19:30</th>
                            
                                <th>19:45</th>
                            
                                <th>20:00</th>
                            
                                <th>20:15</th>
                            
                                <th>20:30</th>
                            
                                <th>20:45</th>
                            
                                <th>21:00</th>
                            
                                <th>21:15</th>
                            
                                <th>21:30</th>
                            
                                <th>21:45</th>
                            
                                <th>22:00</th>
                            
                                <th>22:15</th>
                            
                                <th>22:30</th>
                            
                                <th>22:45</th>
                            
                                <th>23:00</th>
                            
                                <th>23:15</th>
                            
                                <th>23:30</th>
                            
                                <th>23:45</th>
                            
                                <th>24:00</th>
                            
                        </tr>
    </thead>
    
    <tbody>
        
    </tbody>
</table>

Answers

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin

    Do the number of elements in the array of data match the number of columns in the HTML?

    Also, would be good if you could link to a test case, as noting the forum rules.

    Allan

  • heroadheroad Posts: 4Questions: 1Answers: 0

    Thank you allan!

    Yes,the number of columns are matched.

    I'm sorry, I d't know how to do test case in the forum

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin

    The link for "How to ask for help" contains information on how to link to a test case: http://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case .

    Allan

This discussion has been closed.