Complex Header Rowspan and Colspan

Complex Header Rowspan and Colspan

PallyPally Posts: 4Questions: 2Answers: 0

i have html datatable like this

<table id='tblIndividualTransaction'>
            <thead>
                <tr>
                    <td rowspan="2"><input id='checkAll' type="checkbox"/></td>
                    <td rowspan="2">CIF No</td>
                    <td rowspan="2">Customer Name</td>
                    <td rowspan="2">Kegiatan Usaha</td>
                    <td rowspan="2">Latest Assets</td>
                    <td rowspan="2">Source Of Fund</td>
                    <td rowspan="2">Portofolio (IDR)</td>
                    <td colspan="4">Transaction Frequency</td>
                    <td colspan="3">Transaction Amount (IDR)</td>
                    <td rowspan="2">Transaction Analysis</td>
                    <td rowspan="2">DECISION</td>
                </tr>
                <tr>
                    <td>Buy</td>
                    <td>Sell</td>
                    <td>Total</td>
                    <td>Form</td>
                    <td>AVG Buy</td>
                    <td>AVG Sell</td>
                    <td>Total AVG</td>
                </tr>
            </thead>
        </table>

and initialize it at js

var dataTable = $("#tblIndividualTransaction").dataTable({
"bJQueryUI": true,
"bLengthChange": true,
"bDestroy":true,
"sPaginationType": "full_numbers",
"bSort": false,
"bScrollCollapse": true
});

but it it shown error :

Uncaught TypeError: Cannot set property '0' of undefined - jquery.dataTables-1.8.1.min.js:117

i was following this doc ,
https://datatables.net/examples/basic_init/complex_header.html

So what did i do wrong ??

Thank you,

Answers

  • kthorngrenkthorngren Posts: 21,315Questions: 26Answers: 4,948

    Looks like your complex header works in this test case:
    http://live.datatables.net/texacime/1/edit

    Maybe you are getting the error due to the data you are applying to the table. Can you update the test case to show the issue?

    Kevin

  • PallyPally Posts: 4Questions: 2Answers: 0

    i'm using datatables version 1.8.1

    http://live.datatables.net/cobuwotu/1/edit

  • kthorngrenkthorngren Posts: 21,315Questions: 26Answers: 4,948

    Wow, that is old and before my time using Datatables :-) I suspect it doesn't support complex headers but @allan can confirm. Is there are reason to not update to Datatables 1.10?

    Kevin

  • PallyPally Posts: 4Questions: 2Answers: 0

    well, that's because of the old legacy,,,
    a lot of stuff need to be changed, while updating this.

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Yep, it looks like support for rowspan was added later. So you'll need to either upgrade to a later version, or simplify your headers.

    Colin

Sign In or Register to comment.