I am using django datatable the data that come from server has the following format:
[ ['id_value','data col1','data col2',...]
.
.
.]
I am try to make id to every row as follow:
'rowId': 1,
but it doesn't work
my html code:
<table id="mainDataTable" class="table table-responsive-md table-{{ documentvals.table_type }}">
<thead>
<tr>
{% for field in list_fields %}
<th> {{ field }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
{% for field in list_fields %}
<th> {{ field }}</th>
{% endfor %}
</tr>
</tfoot>
</table>
Also, my js code is:
let _columns= [
{% for field in list_fields %}
{ "data": '{{ field }}' },
{% endfor %}
]
$('#mainDataTable').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"info": true,
"columns": _columns,
"autoWidth": false,
"responsive": true,
"aaSorting": [],
"pageLength": pag,
"bProcessing": true,
"bServerSide": true,
"ajax": {
"url": mainUrl,
},
'rowId': 1,
"pagingType": "full_numbers",
destroy: true,
});
I did not want to edit Django datatable library.