jquery datatable submit details

0

I have a jQuery DataTable that has detail, where I click on the line the expand the detail tamplate that makes a request to the server and brings different data from the main table, follow this Example

But my problem now is this, I need instead of tamplate being a detail that expands according to the click of the line, I need it to always be visible, a detail that is not hidden. My question is how to make the main datatable automatically load the detail since it makes a request aside.

In the end I will need to print in my main datatable, printing it and the detail.

Example:

Coluna1| Coluna2| Coluna3|
Valor1   Valor2   Valor3
  Detalhe1| Detalhe2| Detalhe3|
  ValorD1   ValorD2   ValorD3 
    
asked by anonymous 11.07.2017 / 16:40

1 answer

0

Comment everything inside:

$('#example tbody').on( 'click', 'tr td.details-control', function () {
//comentar
});

And add the code:

var trs = $('#example tbody tr');

for(var i = 0, len = trs.length; i < len; ++i) {
    var tr = trs[i];
    var row = dt.row( tr );
    row.child( format( row.data() ) ).show();
}

To hide the buttons, comment out the css:

td.details-control {
    background: url('../resources/details_open.png') no-repeat center center;
    cursor: pointer;
}
tr.details td.details-control {
    background: url('../resources/details_close.png') no-repeat center center;
}
    
11.07.2017 / 20:28