how to choose data for tooltip

how to choose data for tooltip

I'm using datable with json data. I would like to add a tooltip with an information presents ('description') in my json.
How it's possible ? my tooltip always display the same data presents in the row (in my case the 'name' not the 'description').

Answers

I'm not following your thoughts there, sorry. You said that the tooltip is displaying the same as the data, but it would because you have this:

```
"tooltip" title="' + data + '"
````

It might be easier if you created a live example and explained from there what you're after. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

My Json object contains some fields : "id", 'client', "type object", "name", "description".
On my datatable, I display id, client, type object, and name on 4 columns. But the last field "description" I would like to be a tooltip on the name column.
I understand the problem is "data" because it's link to the "name column with "targets":3, but how its 'possible change the data to get the description field ?

I understand. By the time you get to the columns.render function, you would've lost the JSON data. In this example here, I've added the salary field (description in your case) but kept it hidden - that way it's still accessible in the render (hover over the 'Name' column and you'll see the salary as the tooltip.

@colin,
i have been through your example : live.datatables.net/xecowonu/1/edit
can we make a tooltip without creating an extra column(hidden column)?
if yes how do we do that ?
for example: if name=="Airi Satou" // a tooltip should be displayed
else if name=="Ashton Cox" // another tooltip should be displayed
(whenever a criteria is met then only a tooltip should be displayed)
I have used the below code :"fnRowCallback": function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {if (aData[1] == "completed.txt") {$('td:nth-child(4)', nRow).css('background-color', 'Green');} else if (aData[3] == "failed.txt") {$('td:nth-child(4)', nRow).css('background-color', 'Red');}else if (aData[3] == "in-progress.txt") {$('td:nth-child(4)', nRow).css('background-color', 'Orange');}else if (aData[3] == "pending.txt") {$('td:nth-child(4)', nRow).css('background-color', 'Yellow');}else if (aData[3] == "stopped.txt") {$('td:nth-child(4)', nRow).css('background-color', 'Brown');}else if (aData[3] == "running") {$('td:nth-child(4)', nRow).css('background-color', 'blue');}}

instead it changes the background color of the cell when the criteria is met.