Skip to content

clear() API method does not restore the option list #438

@nlwillia

Description

@nlwillia

I noticed this when I ran into problems with the setValue(items) API method.

If I select an item and then use setValue to select a different item, the originally selected item does not appear as an option even though it should no longer be selected. Or if I select all items and then setValue([]), there are no options to choose.

setValue calls clear() which should be resetting the selected state of options in the option list, but this isn't happening. As a result, you get an option list that shrinks until something else forces it to rebuild.

I've found that I can work around this problem by calling refreshItems() after calling setValue, but this really shouldn't be necessary. Here's a demo of the problem in action.

http://plnkr.co/edit/iZhwwd6COtecyA8ZMJsi?p=preview

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions