snapappointments / bootstrap-select

:rocket: The jQuery plugin that brings select elements into the 21st century with intuitive multiselection, searching, and much more.
https://developer.snapappointments.com/bootstrap-select/
MIT License
9.84k stars 2.72k forks source link

bootstrap 5.2.3 and bootstrap-select beta3 programmatically issue #2830

Open mattymatty76 opened 1 year ago

mattymatty76 commented 1 year ago

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...

yangkun commented 1 year ago

same issue.

mattymatty76 commented 11 months ago

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 commented 9 months ago

@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 commented 9 months ago

@ZalemCitizen

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

mhenrixon commented 3 months ago

@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 commented 3 months ago

@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 commented 3 months ago

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.