Keep focus on cell in error state for inline edit
Keep focus on cell in error state for inline edit
http://live.datatables.net/raqoqihe/1/edit
Sorry if this issue has come up before, I couldn't find anything.
I am using the Keytable and Select extension and inline edit. Tab-key is used to tab through the cells.
Also using the initSubmit
event to validate input.
My issue is that it's possible to move "focus" - the orange hard edit borders - away from a cell in error state. Either by keep tabbing or click on a new cell.
True the cursor stays in the error cell, but is it also possible to have the orange borders to revert back to the error cell.
I have attached a simplified example where I have added validation for first_name cannot be empty.
Thank you
This question has an accepted answers - jump to answer
Answers
This thread might help - it's a bit convoluted but the discussion is the same issue that you reported.
Colin
Thanks Colin.
I get the idea, but to me in my use case it feels like a bug in Keytable. The hard edit orange border shouldn't go on a walkabout when tabbing, but stay on the cell in error state.
I tried using the key-focus event to refocus the error cell, see here:
http://live.datatables.net/raqoqihe/4/edit
It kind of works, but impose a new issue; If I - from the cell in error mode - hit Esc or correct the cell input, then the soft edit border stay on the cell and the following cell goes into edit mode, with no border!
Use
preSubmit
for client-side validation: http://live.datatables.net/raqoqihe/6/edit .KeyTable has an event listener specifically for that event being cancelled, which will retain the focus on the current cell.
Allan
Sorry for the late follow-up @allan.
This works perfect now, of course there is no bug, just stupid users.
Thanks a lot