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

After setting new options list and refresh, showing "Nothing selected" #2440

Closed
insad opened this issue Apr 21, 2020 · 4 comments
Closed

After setting new options list and refresh, showing "Nothing selected" #2440

insad opened this issue Apr 21, 2020 · 4 comments

Comments

@insad
Copy link

insad commented Apr 21, 2020

After setting a new list of options on the original (with one of the options with property "selected"), and calling .selectpicker('refresh'), the message "Nothing selected" is shown, though the value of the element is correct.

Workaround:

<select>.empty();
.... fill with <option>, one of them <option .... selected="selected">
<select>.selectpicker('refresh');
const val = <select>.selectpicker('val');
<select>.selectpicker('val', val); // Forces the element to show the correct item
@caseyjhol
Copy link
Member

Bug reports must include a live demo of the problem. Per our contributing guidelines, please create a reduced test case (you can use our preconfigured Plunker), and report back with:

  • your link
  • Bootstrap version
  • bootstrap-select version
  • specific browser and OS details.

If you're not using the latest version of bootstrap-select, please try that as well.

@lcsqlpete
Copy link

I am having this issue too.

Attached is a file that illustrates the problem. The select initially has no options. Click the "Click to populate select" button to load options. I set the data-show-tick option to true so you can see that there is a selected option by clicking the select, but "Nothing selected" still shows.

Apparently github doesn't support .html files so the file is attached as a.txt file.

In addition, the docs describe the noneSelectedText option as "The text that is displayed when a multiple select has no selected options." but I see the text for selects that are not multiple selects. Is this a bug or a documentation issue?

NothingSelectedBug.txt

.

@caseyjhol
Copy link
Member

This has already been fixed in v1.13.16: #2445. This is the main reason I ask for the version of bootstrap-select you're using, as well as the reason I ask you to try the latest version first.

@bhooby
Copy link

bhooby commented Jul 8, 2023

After spending many hours using single quotes for dynamic value fixed my issues.

before
$('#categoryParentID').selectpicker('val' , parentID);

After
$('#categoryParentID').selectpicker('val',''+parentID+'');

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

4 participants