Combine select and input
Combine select and input
danielrm79
Posts: 6Questions: 3Answers: 0
Hi, is it posible to combine two different field types in DataTables Editor?
I mean, if I want to allow users to pick one option from a select, or allow them to type new content, if this content is not in the list.
With the code:
label: "Usuario:",
name: "Usuario",
type: "select",
ipOpts: getUsuarios()
the users can only select one item of the list, but they cannot type a new user.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You could use the Editor plugin selectize for this.
https://editor.datatables.net/plug-ins/field-type/editor.selectize
If you look at this page: https://github.com/selectize/selectize.js/blob/master/docs/usage.md
you'll find the setting "create". This allows the user to enter new content.
I like selectize because you can also limit the number of rows read. When you have a couple of thousand of options read from a database.
Here is an example from my own coding where I explicitly exlude "create".
Thank you very much, It worked for me.