Placing focus on a cell after adding a row

Placing focus on a cell after adding a row

MattDMattD Posts: 27Questions: 2Answers: 0

I'm using the inline editing function on a table and I wanted to have a button that adds a new row at the end of the table. I created a new button and used the .create, .set and .submit to create the row and then reloaded table so it displays the new row. All that worked perfectly (thanks for the update on the documentation!). Now I'm trying to immediately set the focus to the second column in the last row (the newly added one) so that the user can start editing immediately, but I'm at a loss as to how to identify that location. Any input would be much appreciated!

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin
    Answer ✓

    Could you do something like this:

    $('#myTable tbody tr:last-child td:first-child').click();
    

    i.e. select the last row in the table, the first cell in that row and then click it to activate the editing? Does that work in the setup you have?

    Allan

This discussion has been closed.