Last active
March 1, 2018 20:44
-
-
Save possamai/e78cff0de9ba4716a75eecfb2b991101 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<table class="with-details" id="financeiro"></table> | |
<table class="with-details" id="estoque"></table> | |
<table class="with-details" id="blablabla"></table> | |
formatFinanceiro(d) { return 'html_retorno'; } | |
formatEstoque(d) { return 'html_retorno'; } | |
formatBlablabla(d) { return 'html_retorno'; } | |
$('table.with-details tbody').on('click', 'tr.more-details', function () { | |
var table_id = $(this).closest('table').attr('id'); | |
var tr = $(this).closest('tr'); | |
// var row = historic.row( tr ); -> Aqui que eu vou alterar | |
var row = $(this).closest('table').dataTable().row('tr'); | |
if ( row.child.isShown() ) { | |
row.child.hide(); | |
tr.removeClass('shown'); | |
} else { | |
switch( table_id ) { | |
case 'financeiro': | |
row.child( formatFinanceiro(row.data()) ).show(); | |
break; | |
case 'estoque': | |
row.child( formatEstoque(row.data()) ).show(); | |
break; | |
case 'blablabla': | |
row.child( formatBlablabla(row.data()) ).show(); | |
break; | |
} | |
tr.addClass('shown'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment