Select extension - How can i pre-select a row, according to the value of an ajax request
Select extension - How can i pre-select a row, according to the value of an ajax request

I have to mark as selected according to the values from my database how can i do it ?
$('#category'+categoryId).DataTable({
"processing": true,
"bLengthChange": false,
'deferRender': true,
'select': true,
"ajax": {
"url": researchUrl,
"type": "GET"
},
"stateSave": true,
"columns": [
{'data': ''},
{'data': 'company_name'},
{'data': 'phone'},
{'data': 'email'}
],
'columnDefs': [{
'targets': 0,
'defaultContent': '',
'orderable': false,
'className': 'select-checkbox'
}],
'select': {
'style': 'multi',
'selector': 'td:first-child'
}
})
This discussion has been closed.
Answers
Hi EduardoDos,
When using ajax you need to use the
initComplete
function to wait until the data is loaded and then userow().select()
to select the row.Thanks,
Sandy