Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty 'label' replaced with 'value' when using dataprovider #1214

Open
ditor2 opened this issue Sep 25, 2021 · 1 comment
Open

Empty 'label' replaced with 'value' when using dataprovider #1214

ditor2 opened this issue Sep 25, 2021 · 1 comment

Comments

@ditor2
Copy link

ditor2 commented Sep 25, 2021

<select id="example-dataprovider"></select>
<script>
	$('#example-dataprovider').multiselect();
	var options = [
		{label: '', title: 'Option 1', value: '1', selected: true}
	];
	$('#example-dataprovider').multiselect('dataprovider', options);
</script>

This snippet renders this:
<option value="1" label="1" title="Option 1" selected="selected">1</option>

instead of this:
<option value="1" label="" title="Option 1" selected="selected"></option>

When label is omitted totally ( { title: 'Option 1', value: '1', selected: true} ) this behavior is ok.
But when label is explicitly set to empty string then multiselect should not override it.

@s-eckard
Copy link
Collaborator

s-eckard commented Oct 8, 2021

I agree with the solution that the value is only used as a text if the label is missing completely.

s-eckard added a commit to s-eckard/bootstrap-multiselect that referenced this issue Oct 8, 2021
…label is missing in the dataprovider options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants