Closed wesleydeveloper closed 3 years ago
it worked like this. I added the column. And specified the columns in javascript code as well.
$path = dirname(__DIR__).'/database/Chinook_Sqlite_AutoIncrementPKs.sqlite';
$dt = new Datatables(new SQLite($path));
$dt->query('Select TrackId, Name, UnitPrice from Track');
$dt->add('DT_RowId', function($data) {
return 'row_' . $data['TrackId'];
});
echo $dt->generate();
$(document).ready(function () {
$('#example').dataTable({
"serverSide": true,
"responsive": true,
"columns": [
{"data": "TrackId"},
{"data": "Name"},
{"data": "UnitPrice"}
],
"ajax": "ajax/basic.php"
});
});
I would like to use the DT_RowId but I tried using the add method and it didn't work.