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

bootstrap 5.2.3 and bootstrap-select beta3 programmatically issue #2830

Open
mattymatty76 opened this issue May 21, 2023 · 7 comments
Open
Labels

Comments

@mattymatty76
Copy link

In bootstrap 5 when you load programmatically an item (or a list of items) with
$("#select1").selectpicker('refresh');
$("#select1").selectpicker('val', item);
and you try again to reload it more times, the select shows the same object/item a lot of times, while the select should show item just one time because it's the same object.
In the last bootstrap-select with bootstrap 4 works very well as I described, maybe it's a bug.
I would like to say that another issue is when you use programmatically this code
$("#select1").selectpicker('render');
in that case when you try to load an item, the select does nothing...

Thank you very much for the library: one of the best...

@mattymatty76 mattymatty76 changed the title bootstrap 5.2.3 and bootstrap-select beta3 bootstrap 5.2.3 and bootstrap-select beta3 programmatically issue May 21, 2023
@yangkun
Copy link

yangkun commented Jun 4, 2023

same issue.

@mattymatty76
Copy link
Author

mattymatty76 commented Jul 20, 2023

Hello everybody,
I have updated the library bootstrap-select(v1.14.0-beta3).js and a lot of problems have been fixed: at least in my case it works very well now.
Of course I didn't adapt all library in its functions, but just some that for me didn't work: you can compare it with the original to detect the changes. In any case, finally, I can use it with bootstrap 5.3.0 without problems.
Two raccomandations: when you use the instraction

  1. $('.selectpicker').selectpicker('val', item);
    the function, at the end, calls refresh and not render
  2. don't use render, to redrow the list of items, but refresh if you want to update the list...
    $('.selectpicker').selectpicker('refresh');

NOTE: I have used the separator ' | ' but you can change it with a comma

this is the link to the file, I hope it will be useful for you

https://gist.github.com/mattymatty76/c996d3b77f298b2ec133be59992df9d4

@ZalemCitizen
Copy link

@mattymatty76

I haven't tested your modified version heavily yet but so far, it seems to solve serious issues in beta2 and beta3
I'm using it with boostrap 4.6
Thanks for your proposal.

@mattymatty76
Copy link
Author

mattymatty76 commented Sep 24, 2023

@ZalemCitizen

It's a pleasure to know that it is useful for you
thank you

@mhenrixon
Copy link

@mattymatty76 did you have to do anything for the CSS? The provided CSS from this library doesn't work at all for me:

CleanShot 2024-03-21 at 15 42 51@2x

@mattymatty76
Copy link
Author

@mhenrixon
have you tried to use the right css file? You could try with bootstrap css 5.2 or 5.3 and assure yourself that there aren't any other files in conflict with bootstap.css.
In my case work at all

@mhenrixon
Copy link

Have you tried to use the right css file?

This was me having to restart esbuild on every change. Will switch to Vite instead. Esbuild seem backward to me.

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

No branches or pull requests

4 participants