-2
I was able to pull all the data from my selected line. But I want to access only the value of a property, for example id_produto
. How do I do?
I’ve managed to print out all the data on the console:
$( document ).ready(function() {
var table = $('#tbl_estoque').DataTable( {
"ajax": "data.php",
"bPaginate":true,
"bProcessing": true,
"pageLength": 5,
"columns": [
{ mData: 'cod_produto' } ,
{ mData: 'cat_produto' },
{ mData: 'descricao_produto' },
{ mData: 'qnt_total' },
{ mData: 'qnt_vendido' },
{ mData: 'valor_produto' },
{ mData: 'valor_total' },
{defaultContent: "<button>Click!</button>"}
]
});
$('#tbl_estoque tbody').on( 'click', 'tr', function () {
console.log( table.row( this ).data() );
} );
$('#btn_load').click( function () {
table.ajax.reload(null, false);
});
});
After placing the console.log( table.Row( this ).data('id_product') ); Look at the console as it turned out:
Instead of using a photo, post the code in text format using code block formatting. :)
– Luiz Felipe
Sorry! I put the code.
– Frank Washington