Skip to content

Changing the collection with a selected (no longer valid) modelValue results in first element selected #184

@hawkeye-bot

Description

@hawkeye-bot

When there is a change in the available options, the onCollectionChange function is called. In this function, there is a check that verifies if the previously selected value is still available in the new collection. If the new collection does not contain the previously selected value, the first element of the new collection is selected.

This is undesired behaviour, as it presumes to know what the right value will be in this situation. I cannot imagine there is a scenario where you would want the system to select 'the first' option available if the previous selection is no longer available.

This action is performed in https://github.com/lordfriend/nya-bootstrap-select/blob/master/src/nya-bs-select.js on line 291:
if(!contains(valuesForSelect, modelValue)) { modelValue = valuesForSelect[0];

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions