I’m initializing the .dataTable() the following way:
$(document).ready(function(e) {
var articles_table = $("table#datatable-articles").dataTable({
'bProcessing': true,
'bServerSide': true,
'rowHeight': 'auto',
"bAutoWidth": true,
'sAjaxSource': '/admin/articles/data',
sPaginationType: "full_numbers",
});
Then, I’m trying to get the id value that is in the tbody > tr > td:first and save it in a variable, and then hide the field. No luck, everything that I tried, didn’t work.
var ex = $('table#datatable-articles');
if ( $.fn.DataTable.fnIsDataTable( ex ) ) {
console.log(ex.find('tbody tr td:first'));
ex.find('tbody tr td:first').css('backgroundColor', 'blue');
}
/
articles_table.$('tbody tr:odd').css('backgroundColor', 'blue');
console.log(articles_table.find('tbody tr td:first').val());
articles_table.find('tbody tr td:first').html('1');
All the above executes on dom ready, but then the dataTable is initialized and replaces everything with its data
The basic question is: How to obtain the id value from the table data and then hide it?
This is what I ended up with, and it works…
inside
dataTable()have added the following