Skip to content

Cloning a selectize input. #145

@jayalfredprufrock

Description

@jayalfredprufrock

I'm in the process of swapping out select2 with selectize on an application and have run in to a slight hiccup that I'm not sure how to handle.

I've written some javascript that allows me to easily add new rows of one or more inputs. So for example, I might have a row that contains first name, last name, and user type with a button on the far end that allows users to add multiple people. With select2, I simply cloned the row, discarded the initialized select2 instance/content, and then reinitialized the select element with select2. Since selectize doesn't keep the original select dom element in tact, this solution is no longer possible. Furthermore, I don't see any exposed methods that allow you to grab all the options or to clone an existing selectized input, so I'm not sure of the best way to go about getting this functionality back in place.

I know that selectize provides tagging support for the multiple selection use case, but that's not always desirable. I'm sure I can hack things together, but I was hoping that somebody might suggest a clean solution or a small addition to the API that would make this particular use case easier.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions