Custom attributes getting ignored when using option groups
SharkFourSix opened this issue · 0 comments
SharkFourSix commented
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.