Code Monkey home page Code Monkey logo

Comments (8)

mattymatty76 avatar mattymatty76 commented on June 23, 2024

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

from ajax-bootstrap-select.

dolrichfortich avatar dolrichfortich commented on June 23, 2024

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

from ajax-bootstrap-select.

JuanLlanso avatar JuanLlanso commented on June 23, 2024

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.

from ajax-bootstrap-select.

dolrichfortich avatar dolrichfortich commented on June 23, 2024

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', '');
});

from ajax-bootstrap-select.

JuanLlanso avatar JuanLlanso commented on June 23, 2024

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.

from ajax-bootstrap-select.

dolrichfortich avatar dolrichfortich commented on June 23, 2024

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

from ajax-bootstrap-select.

JuanLlanso avatar JuanLlanso commented on June 23, 2024

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.

from ajax-bootstrap-select.

mattymatty76 avatar mattymatty76 commented on June 23, 2024

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

from ajax-bootstrap-select.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.