datatable Add row input
datatable Add row input
Escobedo97
Posts: 12Questions: 7Answers: 0
im using ths as an example: http://live.datatables.net/cepasoda/10/edit
how can i auto focus on the created input element after clicking on the add row button
This question has an accepted answers - jump to answer
Answers
There are two steps needed. First is to display the page the new row is added to. The apge is determined by the table sorting. Second is to find the input of the new row and use jQuery focus() to focus the input.
To go to the page of the new row you can use the page.jumpToData() plugin or the row().show() plugin. You can find these plugins here.
The
row.add()
API returns the row that was added. You can then userow().node()
to get the node then find theinput
to focus. Updated example:http://live.datatables.net/cepasoda/13/edit
Kevin