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

Displaying selected items when using the data-selected option #59

Closed
pnr32 opened this issue Oct 12, 2022 · 6 comments
Closed

Displaying selected items when using the data-selected option #59

pnr32 opened this issue Oct 12, 2022 · 6 comments

Comments

@pnr32
Copy link

pnr32 commented Oct 12, 2022

We use the following code:

<select
    class="form-select w-auto"
    id="new-task-regions"
    name="new-task-regions"
    multiple=""
    data-server="https://mocki.io/v1/0c5b5251-b7d6-4be8-9d11-304fd930171a"
    data-allow-clear="true"
    data-clear-end="true"
    data-live-server="true"
    data-full-width="true"
    data-suggestions-threshold="0"
    data-show-all-suggestions="true"
    data-keep-open="true"
    data-selected="1"
    style="display: none"
  ></select>

View on Codepen

The pre-selected tag from data-selected attribute is not displayed during initialization.
It is displayed only after entering any character.

How fix it?

@pnr32
Copy link
Author

pnr32 commented Oct 12, 2022

The problem is relevant only when using the liveServer option is true.

@lekoala
Copy link
Owner

lekoala commented Oct 13, 2022

@pnr32 this should fix it
https://github.com/lekoala/bootstrap5-tags/releases/tag/1.4.39

@pnr32
Copy link
Author

pnr32 commented Oct 14, 2022

@lekoala , in the example presented earlier, tags from the data-selected attribute are also not displayed.

@lekoala
Copy link
Owner

lekoala commented Oct 14, 2022

data-selected is fundamentally incompatible with live server which returns a filtered list
if the json returned by the server should populated the default selected options, then you need to disable live server

@lekoala
Copy link
Owner

lekoala commented Oct 14, 2022

i guess that technically, if you use suggestions-threshold="0" then the "live server list" is not filtered and therefore we could enable this... mhh i need to look into it :-)

@lekoala
Copy link
Owner

lekoala commented Oct 25, 2022

closing for now ;-)

@lekoala lekoala closed this as completed Oct 25, 2022
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