Avoid focus in select2 fields or disable auto focus in specific fields
Avoid focus in select2 fields or disable auto focus in specific fields
Lucho_1312
Posts: 30Questions: 9Answers: 0
in Editor
Hi!
Is it possible to avoid the automatic focus in the first field when it is a select2 field? If that's not possible, is it possible to manually stop the autofocus for certain field?
The problem is that when I have a select2 field and I click in the edit button, the modal pops up and the select2 field gets open, which is quite annoying for the user.
Thanks!
Luciano
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You can use the
focus
parameter of theform-options
object to tell Editor what field (if any to focus on). If you don't want any field to be focused on then set it tonull
.Allan
Thanks! I hadn't found that option before.
Anyway, it's not working. Is it possible that the problem is that I'm using Editor with DataTable?
Or maybe because my first element is a select2 field?
Thanks!
Luciano
Can you give me a link to the page so I can check why it isn't working please?
Allan
I working locally and it's quite complex to give you an example, but I made it work!
The problem was that I was setting the formOption.focus in the Editor instance, but not in the action that opens the Edit modal.
Moving the setting there was enough.
Thanks! We can close this thread.
Luciano
Super - good to hear you have it working now. Thanks for posting back.
Allan