Focus on a Text Field of the first row in DataTable
Focus on a Text Field of the first row in DataTable
reddy23
Posts: 11Questions: 5Answers: 0
Hello People,
I have a Child DataTable where one of it's field is a Text field and I want to focus the first row's Text field when user expand to see the Child Table. I have ID for that Text field is Data.
{ "data": "firstName",
"render": function(data, type, full, meta )
{
$('#fname'+full.empId).focus();
return '<input type="text" class="numonly form-control" onkeyup="checkInput(this)" id="fname'+full.empId+'" value=" '+data+' ">';
}
},
I have several rows but I want to focus the first row.
Help is highly appreciated,
Thanks,
Reddy
This discussion has been closed.
Answers
Can anyone help me on this issue. Please.
Add an initComplete: on the child table. Within the initComplete would be the .focus() method.
https://datatables.net/reference/option/initComplete