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

In Bootstrap 5.2.3 Ajax-Bootstrap-Select doesn't work #218

Open
mattymatty76 opened this issue May 17, 2023 · 8 comments
Open

In Bootstrap 5.2.3 Ajax-Bootstrap-Select doesn't work #218

mattymatty76 opened this issue May 17, 2023 · 8 comments

Comments

@mattymatty76
Copy link

mattymatty76 commented May 17, 2023

Hi everybody, unfortunately I'm testing bootstrap 5 with ajax select but it doesn't work.
I have used the bootstrap-select 1.14.0-beta3 that works with bootstrap 5 without problem, in a simple/classic select, but when I attempt to use ajax-select (that uses bootstrap-select 1.14.0-beta3) the result is not reliable: as the result list has a strange behavior, for example if you want to chose more than one element, you can't despite multi selection is enabled; moreover when you click dropdown-button to open it and soon after close it, the library sets a list of separator inside of the select.

Thank you very much for the library very usefull and admirable, reason why I would continue to use it.

@mattymatty76
Copy link
Author

mattymatty76 commented May 17, 2023

I noticed that when I load an element in the ajax-select, and after loading it a second time (same identical item) the ajax-select adds it like a new item and so on repeating the element: the correct behavior should be that if the element is previus loaded the library hasn't to load it anymore...

PS: I don't expect anyone to fix it, I'm just saying this for clarity and transparency... thank you

@dolrichfortich
Copy link

This is a bug on the bootrap-select script.
The fix here is working fine for me.
snapappointments/bootstrap-select#2738 (comment)

@JuanLlanso
Copy link

The fix almost work, but there is still a issue.
When you select another item in the loaded list, if the item is below there is no problem, but if the item is above, the text of the selected item doesn't change.

@dolrichfortich
Copy link

I had issue with multiple items being selected, not sure if will fix with the issue you have.

$('#selector')
  .selectpicker()
  .ajaxSelectPicker({
    ajax: {
      url: '/ajax_search',
    },
    locale: {
      emptyTitle: 'Search...'
    },
    preserveSelected : false
  });

//Added the code below
$('#selector').on('shown.bs.select', function() {
  $('#selector').selectpicker('val', '');
});

@JuanLlanso
Copy link

No, it doesn't work, but what works is to change preserveSelected to true. The selected item is shown in a different line/section but it works fine that way.

@dolrichfortich
Copy link

Thank you for that, selection is working fine without the added code.

@JuanLlanso
Copy link

I like it more with the preserveSelected to true because in my case it separates the options from the one that is selected, but this depends on the use you are giving to the control. Without that it doesn't work when you select an option that is above the current selection.

@mattymatty76
Copy link
Author

Hello guys,
I have fixed the issue, now ajaxselect works well, at least for me and for the test that I have done.

snapappointments/bootstrap-select#2830

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

3 participants