user2661518
user2661518

Reputation: 2745

add tooltip to specific column of datatables

I have table defined in html as <table id="tableDynamic"></table>

And I am updating table dynamically as

    $('#tableDynamic').DataTable( {
        columns: [
            { title: data[0] },
            { title: data[1] },
            { title: data[2] },
],

        "columnDefs": [
            {
                "render": function (data, type, row){
                    return '<a>' + row[0]  +'</a>';

                },
                "targets": 0
            },
        ]
    } );
}

How can I add tooltip just to specific column data[2]

Upvotes: 2

Views: 3708

Answers (1)

Syl20
Syl20

Reputation: 127

You could also do it like this (call any other javascript after Datable initialisation is complete):

 $('#tableID').DataTable({

    [...]

   fnDrawCallback: function(oSettings, json) {
      //Call JS here
      alert( 'DataTables has finished its initialisation.' );        
      tooltip('.selector', 'theme');
    }

  });

I asked a somewhat similar question here. Look at YouneL answer for more details, and an example to do the same with a call back.

Upvotes: 1

Related Questions