Allowing multiple items in column while using select searching

Allowing multiple items in column while using select searching

papertigerKKpapertigerKK Posts: 4Questions: 1Answers: 0
edited February 2020 in Free community support

Thsi is kind of a confusing thing to explain so here's an example:

http://live.datatables.net/kixurigu/1/

Basically I have a client that want to tag one row with multiple items. For example they have a row that has "Offices" and for each row they want to be able to add multiple, e.g. "Sydney, Tokyo" but still have separate items in the dropdown search.

Try searching the "Offices" dropdown.

Any help would be appreciated!

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,167Questions: 26Answers: 4,921

    There are a few threads with this question. See if this one helps:
    https://datatables.net/forums/discussion/comment/159668/#Comment_159668

    Kevin

  • papertigerKKpapertigerKK Posts: 4Questions: 1Answers: 0
    edited February 2020

    @kthorngren

    Hey, that doesn't solve the problem posed.

    There are multiple items inside the "Offices", I need to break each one up so they appear as different options in the dropdown.

    Right now they appear as: "Tokyo, New York"
    And I need: "Tokyo" and "New York" as separate options

  • papertigerKKpapertigerKK Posts: 4Questions: 1Answers: 0

    Here's a screenshot of the problem:

  • kthorngrenkthorngren Posts: 21,167Questions: 26Answers: 4,921
    Answer ✓

    Sorry, I misread the question. The code where the options are built you can use split(',') to get an array of the data. Then loop the array and append each onto the options, for example:
    http://live.datatables.net/kixurigu/3/edit

    The example isn't complete as the options aren't sorted. I'll leave it to you to re-work the loops to place the options in the order desired.

    Also note that I changed the search mode from regex to smart search. Details of this is in the search() docs.

    Kevin

  • papertigerKKpapertigerKK Posts: 4Questions: 1Answers: 0

    Amazing, thanks you so much!

This discussion has been closed.