I just started using DataTables and I am trying to show extra information (retrieved through AJAX) within a Responsive DataTable.
Extra information example - Link 1
Responsive table example - Link 2
That means, on a big screen, the table will show some 'extra information' about each row on expanding. On a small screen, I want the table to show the extra information, as well as the rows hidden for responsive purpose.
However, this is not happening.
- In large view, DataTable only shows the extra information on expanding a row. This is as expected.
- But on a smaller screen, it shows ONLY the rows which it hides and the extra information which was shown before, is completely gone.
Is there any way where I can get the Hidden columns AND some Extra information to show when the row is expanded?
I would really appreciate if someone could help me with this.
function format ( d ) {
    
    return '<table cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;">'+
        '<tr>'+
            '<td>Full name:</td>'+
            '<td>'+d.name+'</td>'+
        '</tr>'+
        '<tr>'+
            '<td>Extension number:</td>'+
            '<td>'+d.extn+'</td>'+
        '</tr>'+
        '<tr>'+
            '<td>Extra info:</td>'+
            '<td>And any further details here (images etc)...</td>'+
        '</tr>'+
    '</table>';
}
$(document).ready(function() {
    var table = $('#example').DataTable( {
        "ajax": "./data/arrays.txt",
        responsive: true,
        "columns": [
            {
                "className":      'details-control',
                "orderable":      false,
                "data":           null,
                "defaultContent": ''
            },
            { "data": "name" },
            { "data": "position" },
            { "data": "office" },
            { "data": "salary" }
        ],
        "order": [[1, 'asc']]
    } );
     
    $('#example tbody').on('click', 'td.details-control', function () {
        var tr = $(this).closest('tr');
        var row = table.row( tr );
 
        if ( row.child.isShown() ) {
            
            row.child.hide();
            tr.removeClass('shown');
        }
        else {
            
            row.child( format(row.data()) ).show();
            tr.addClass('shown');
        }
    } );
} );<table id="example" cellspacing="0" class="display stripe compact row-border no-wrap" width="100%">
 <thead>
  <tr>
   <th>Expand</th>
         <th>Name</th>
         <th>Position</th>
         <th>Office</th>
         <th>Salary</th>
  </tr>
 </thead>
</table> 
    