Skip to content

when given optionsGroups tailselect automatically selects some random option #31

@boxxxie

Description

@boxxxie

in my example HTML i want tail to use the placeholder on init (no options are selected)

tails instead selects "Development" option

i have to use this workaround to fix it

  let tails = tail.select(element, tail_select_options);
  if (selection.length === 0){
    tails.updateLabel(placeholder || "Choose an Option")
    const selected_options = tails.options.selected
    selected_options.forEach(opt => tails.options.unselect(opt)) // deselect any selected options
  }

example HTML:

<select tail-select
        name="project[project/project-stage]"
        data-class-names="ui fluid"
        data-placeholder="Choose an Option"
        up-data='{{project.project/project-stage|json}}' >

    <optgroup label="Real Estate">

        <option  value="project-stage.type/development">
            Development
        </option>

        <option  value="project-stage.type/acquisition">
            Acquisition
        </option>

        <option  value="project-stage.type/stabilized">
            Stabilized
        </option>

    </optgroup>

    <optgroup label="Equity VC Start-ups">

        <option  value="project-stage.type/pre-seed">
            Pre-Seed
        </option>

        <option  value="project-stage.type/seed">
            Seed
        </option>

        <option  value="project-stage.type/early-stage">
            Early Stage
        </option>

        <option  value="project-stage.type/mid-stage">
            Mid Stage
        </option>

        <option  value="project-stage.type/late-stage">
            Late Stage
        </option>

    </optgroup>
</select>

got any idea where i should start investigating to make a PR?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions