javascript - Expand Child Rows of Responsive Datatables automatically -


i have responsive datatable (responsive doc.) in following format:

var datatableinfo = j$('[id$="datatableinfo"]').datatable({                  responsive: {                     "autowidth": true,                     details: {                         type: 'column',                         target: 0                     }                 },                 columndefs: [ {                     classname: 'control',                     orderable: false,                     targets:   0                 } ]             }); 

i fill data through search external data source , have second table inside datatable additional data (in child row) comes automatically instaniation. can click on icon in first column expand , show child row, works fine.

what want accomplish automatically expand child rows through javascript of datatable, once data has been loaded (i know when occurs in callback function).

i have tried multiple variation of following:

function expandtable(){         var tab = j$('[id$="datatableinfo"]').datatable();         alert(tab);          tab.rows().every( function () {              this.child.show();          } );     } 

but table won't expand child rows. nothing happens , no error messages in console.

can me in explaining how example can simulate button click according this:

$('#example tbody').on( 'click', 'tr', function () { var child = table.row( ).child;  if ( child.isshown() ) {     child.hide(); } else {     child.show(); }} ); 

or in other way automating expanding of child rows.

ciao!

it seems responsive plug-in it's own child row management, maybe that's why row().child.show() not work.

you can send click event first cell of every visible row on page expand child rows:

function expandtable(){     j$('[id$="datatableinfo"] tbody td:first-child').trigger('click'); } 

Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -