Sort column by class name when we have colspan in a column?

Sort column by class name when we have colspan in a column?

deyvidpinzondeyvidpinzon Posts: 2Questions: 1Answers: 0

In this case:

                <thead>
                    <tr >
                        <th rowspan="2"> <spring:message code="contrato" /></th>
                        <th colspan="2"> <spring:message code="empresa" /></th>
                        <th rowspan="2"> <spring:message code="motivo" /></th>
                        <th class="sorted desc" rowspan="2"> DATA BLOQ. </th>
                        <th rowspan="2"> COLAB. BLOQ. </th>
                        <th rowspan="2"> DATA LIBER. </th>
                        <th rowspan="2"> COLAB. LIBER. </th>
                    </tr>
                    <tr>
                        <th> ID EMP.</th>
                        <th> NOME EMP.</th>
                    </tr>
                </thead>

If I use $('th.sorted').index() it will return 3, but the correct one for the table body should be 4, because of colspan.
How can I fix this?

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,425Questions: 26Answers: 4,794
    Answer ✓

    Try:
    table.column($('th.sorted')).index()

    Kevin

  • deyvidpinzondeyvidpinzon Posts: 2Questions: 1Answers: 0

    Oh man... Thanks! :)
    This solves my problem!

This discussion has been closed.