Select a row from JS
Select a row from JS
ostmal
Posts: 102Questions: 33Answers: 0
in DataTables
I would like to select table row from JS. I do it like here:
https://www.datatables.net/reference/api/row().select()
var table = $('#myTable').DataTable();
table.row(':eq(0)', { page: 'current' }).select();
But I can't do anything. The row in the table is not selected!
This question has an accepted answers - jump to answer
Answers
Did you add the select library?
Your example code works here:
http://live.datatables.net/mixisovi/1/edit
Kevin
I did everything as it should, as in the example that you provided. It doesn't work (
My test example:
http://www.a0250268.xsph.ru/index.php/edit-err
Since you are Ajax loading the data you need to wait for the data to actually be loaded. At the moment, there is no data in the table when your
row().select()
call runs.You can use
initComplete
to address that - e.g. in this case:Allan
Allan, everything works fine! Thank you very much!