Skip to content

[Dropdown] item data value is cleared when dropdown message is shown #3622

Closed
@mdehoog

Description

When creating a searchable dropdown from existing HTML, the dropdown item's value property in the element data is cleared when searching and no results are available. This is because, when the "No results" message is shown, the menuObserver mutation observer is fired which calls module.refresh(), which in turn calls module.refreshData() which removes the value and text data values from the item elements.

Here is a jsbin that reproduces the issue: http://jsbin.com/runetopasi/edit?html,js,output

Here is the code that removes the value and text data from the items:

$item
.removeData(metadata.text)
.removeData(metadata.value)
. Could you please explain the reason behind this code? Otherwise, simply removing these lines will fix this issue.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions