Table.Cell() resetting tab focus

Table.Cell() resetting tab focus

wadeparallonwadeparallon Posts: 96Questions: 10Answers: 0

Link to test case: Having trouble creating the same test with the site as we're populated with ajax JS

Description of problem: We've created an form very similar to https://datatables.net/examples/api/form.html

We've got several calculated columns being show in another column based on the the inputs give. We've created an onblur that does some calculations and populates via:

table.cell(rowIndex, 4).data(newValue);
table.draw(false);

The issue we're having is that every time we tab from ANY of the fields, the tab goes back and highlights the first form field in the first row. We essentially can't tab off of it.

Let me say that we've commented out the table.cell().data() and we can. I even left the table.draw() in there to make sure the draw wasn't resetting the focus. Anytime we use table.cell().data() it sticks the focus on the first field. I couldn't find anything in the documentation about updating the cell causing focus issues or draws.. so I'm stumped.

Replies

  • kthorngrenkthorngren Posts: 22,034Questions: 26Answers: 5,082

    I took the example you linked to and created a blur event handler.
    https://live.datatables.net/surineqa/1/edit

    It doesn't move the focus to another cell when cell().data() is used. Possibly there is something else on your page causing the focus to change. Are you doing something with ajax during this process? If not then maybe you can update my test case to replicate the issue.

    Kevin

  • kthorngrenkthorngren Posts: 22,034Questions: 26Answers: 5,082

    table.cell(rowIndex, 4).data(newValue);

    I would place a debugger breakpoint on this line and step through the code to see when the focus changes.

    Maybe the problem is specific to the version of Datatables being used.

    Kevin

  • wadeparallonwadeparallon Posts: 96Questions: 10Answers: 0

    Oh man, thanks. I'll see what I find and come back and update.. the only thing I can see that we are doing differently is the fact that we are setting a rowData value then taking that and putting in the the cell.data(). I'll dig deeper.

    Thanks again

Sign In or Register to comment.