Editor multiple select without array
Editor multiple select without array
I have converted a large database to DataTables where one field is a list of municipals like thie "Oslo, Luster, Bremanger". I want to be able to edit the field "Kommune" with a drop down list of all available municipals. The problem with using the solution like in "Multiple Select" is that I can not use the already entered values since the field relies on an array of items while my fields are only comma-separated text. I want to be able to do things like in this multi-select dropdown list So I would like to choose from a populated select dropdown and clicking an item adds it to the input separated with comma. Does anyone have an example of this or must I write this outside Datatables?
Replies
The
selectfield type has aseparatoroption which allows it to work with string based data for multiple values. Set itsmultipleoption totrueandseparatorto be a comma.The same applies to
tagswhich is a bit more like the demo you linked to with a dropdown list that can be searched etc. Demo oftagswith multiple selection available here.Allan
Thanks Allan, I think the
multipleoption for theselect fielddoes exactly what I want for this field! The tags field seems to make an array so it would not work on the old records. But very nice anyway!With
separatorspecified as a comma, it should also work on the list. Good to hear thatselectwill do the job for you though.Allan