Problem with with span and columnDefs

Problem with with span and columnDefs

teggertegger Posts: 2Questions: 1Answers: 0

Hi,
i need help with sorting and a mouseover tooltip

i use <td id="grungruppe"> <div class="tooltip">1050 <span class="tooltiptext"> TEST</span> </div> </td>
to create a Number with mouseover tooltip. But datatable can now not use it as a number, still manual override with html-num or num did not work

$(document).ready(function() {
            $('#example').DataTable({
                paging: false,
                bFilter: false
                ,
                "columnDefs": [
                    { "type": "html-num", "targets": 19 }
                  ]
            });
         
         } );

How could i solve this ?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 62,315Questions: 1Answers: 10,225 Site admin
    Answer ✓

    If you strip the HTML you are left with 1050 TEST which is why DataTables is string sorting that column.

    You'd probably need to implement your own custom ordering plug-in for that, pulling out the data that you want from the HTML.

    Orthogonal data is another approach you could consider.

    Allan

  • teggertegger Posts: 2Questions: 1Answers: 0

    thanks, the orthogonal data are working perfectly

This discussion has been closed.