Datatables: Assign value of a 'row detail' to the "title" of 'column'

1.8k Views Asked by At

This is what I have in row details:

<script>
/* Formatting function for row details - modify as you need */
function format ( d ) {
return '<table><tr><td style="vertical-align: top !important;"><table cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;">' +
    '<tr title="This company is PetroBras, which is in Brasil.">'+
      '<td><strong>Vendor</strong>:</td>'+
      '<td style="text-align: right">' + d['Name'] + '</td>'+
    '</tr>'+
    '<tr title="Earliest date orders are due.">'+
      '<td><strong>Min Date</strong>:</td>'+
      '<td style="text-align: right">' + d['Min Date'] + '</td>'+
    '</tr>'+...

This would show as:

Vendor: PetroBras

Min Date: 09-01-2015

Now I want to attach a value from it, say, d['Name'] and make it a title attribute of a Vendor column in the following:

var table = $('#peacecard').DataTable({
    "ajax": "http://localhost:8080/peace_reports/data.php",
    "columns": [
      {
        "className":      'details-control',
        "orderable":      false,
        "data":           null,
        "defaultContent": ''
      },
      { "data": "Name" },
      { "data": "Vendor", "className": 'dt-right' },
      { "data": "Department", "className": 'dt-right' }...

I can't make it like { "data": "Vendor", "className": 'dt-right', "title":"d['Name'] }".

The ultimate idea is to use jQueryUI Toolkit for it, so that the PetroBras would appear as a beautiful tooltip when I hover over "Vendor" column.

Thanks!

1

There are 1 best solutions below

0
AmazingDayToday On
"columns": [
{ "data": "case", "render": function(data, type, row, meta){
                                if (data == "true"){ 
                                var allCase = row['case2'];
                                data = "<i title="+ allCase +" id='thei'; } 
                                else { data = ""; }
                                return data; }, 
                                "className": 'dt-center'}

I found out that row has everything inside.