Using a datalist or Select2, if text entry is not already there, add it?

Using a datalist or Select2, if text entry is not already there, add it?

rob1strob1st Posts: 84Questions: 22Answers: 0
edited April 2022 in Editor

A question if this is possible in datatables?

Assume I have the generic ice cream flavours of chocolate, strawberry & vanilla.

In my table I request the flavour, and the person types 'Mint', when they save is it possible to add 'Mint' to the flavours table so it is an options when the next person uses the form?

I've been looking through the editor and don't see this, but as always I may find it 2 mins after posting the question.

Happy Easter.

RB

This question has an accepted answers - jump to answer

Answers

  • rf1234rf1234 Posts: 2,806Questions: 85Answers: 406
    Answer ✓

    With the new field type "datatable" this is possible but a bit more complicated in my opinion. Here is an example for "nested editing" which is not what I had expected but it certainly works:
    https://editor.datatables.net/examples/datatables/nested.html
    You'll find a lot more examples for field type "datatable".

    Another way is using "selectize" and allowing for new options being inserted on the fly. But that isn't well supported by Editor: In case you make a new option there is not an id of an existing option returned to the server but the new option itself. You need to recognize that "manually" on the server and to the proper processing for it.
    More on that here:
    https://datatables.net/forums/discussion/comment/133909/

  • rob1strob1st Posts: 84Questions: 22Answers: 0

    Awesome answer, thank you

Sign In or Register to comment.