Skip to content
This repository was archived by the owner on Dec 7, 2021. It is now read-only.
This repository was archived by the owner on Dec 7, 2021. It is now read-only.

Custom attributes getting ignored when using option groups #151

@SharkFourSix

Description

@SharkFourSix

When adding data using the new Selectr(..., {data: []}) method, custom attributes seem to be ignored versus when adding them through instance.add(...), which also ignores option groups.

The following does not seem to work properly (Only adds the groups)

selector.add(
    [ text: 'Group 1', children: [ {'text': 'Text 1', 'value': 'Value 1'}, {'text': 'Text 2', 'value': 'Value 2', 'data-custom': 3} ] ],
    [ text: 'Group 2', children: [ {text: 'Group 2, Text 1', value: 'Value 2'}, {text: 'Group 2, Text 2', value: 'Value 2', , 'data-custom': 6} ] ]
);

This works but does not attach the 'data-custom' attribute to the option elements

new Selectr('#mySelect', {data: 
    [ text: 'Group 1', children: [ {'text': 'Text 1', 'value': 'Value 1'}, {'text': 'Text 2', 'value': 'Value 2', 'data-custom': 3} ] ],
    [ text: 'Group 2', children: [ {text: 'Group 2, Text 1', value: 'Value 2'}, {text: 'Group 2, Text 2', value: 'Value 2', , 'data-custom': 6} ] ]}
);

Is there a work around for this?

I would like to have the option groups as well as custom attributes.

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