Select extension not working with selecting first row
Select extension not working with selecting first row
Hi there
I have been trying various things, but I can't get it to select the first row automatically. The extension itself works fine and I can select rows manually.
I have read in other topics that people have had this working:
var table = $('#example').dataTable( {
"searching": false,
"paging": false,
"info": false,
"select": true
} );
table.row(':eq(0)').select();
But nothing happens - is there anyone with an idea for this?
Kindly regards
Nicolai
This question has an accepted answers - jump to answer
Answers
Try changing the
dataTable
toDataTable
:var table = $('#example').DataTable( {
Check out the first FAQ here:
https://datatables.net/faqs/index#Most-common-FAQs
Kevin
Hi there,
Thanks for the input - however it did not solve the problem. I have tried with both dataTable as the example I posted and DataTable. Still not selecting the first row.
I have a standard build, from the datatable builder with the select extension for the ccs and js files.
I initiate both the table and the select in a $(document).ready(function() {
Any other ideas?
Yes, post a link to a test case so we can take a look into it please . I don't see anything wrong with the above. I might guess that the data was being loaded async, but that isn't shown in the above code.
Allan
Hi again,
I had an error in some other code, which causes it to not correctly initiate the table.row(':eq(0)').select(); line. It has now been fixed and it now works as intended.