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

Custom attributes getting ignored when using option groups #151

Open
SharkFourSix opened this issue Oct 20, 2021 · 0 comments
Open

Custom attributes getting ignored when using option groups #151

SharkFourSix opened this issue Oct 20, 2021 · 0 comments

Comments

@SharkFourSix
Copy link

SharkFourSix commented Oct 20, 2021

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant