question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot instantiate an AjaxBootstrapSelect instance without selectpicker first being initialized!

See original GitHub issue

I’m trying to use this awesome plugin in a BS modal but I got this:

Cannot instantiate an AjaxBootstrapSelect instance without selectpicker first being initialized!

a piece of code:

selectPartner = jQuery('.select-partner'); selectPartner.selectpicker({ bindEvent: 'keyup paste' }).ajaxSelectPicker({

I’ve tried wrapping ‘ajaxSelectPicker’ in a setTimout and it seems to work.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:17 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
dmazilovcommented, Dec 21, 2017

There is option to use $(“select.your-ajax-select-class”), not only id. It works in my case.

2reactions
pranay16commented, Mar 7, 2019

@dmazilov 's solution works perfectly.

The reason we were seeing that error was because we call this function multiple times… First time, $(“.your-ajax-select-class”)… works just fine.

However, selectpicker puts the same class on the div it creates around the <select> for its own display

Now the next time we do $(“.your-ajax-select-class”)… It tries to add ajaxselectpicker to the div and it fails.

Hence, $(“select.your-ajax-select-class”) solves the issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

truckingsim/Ajax-Bootstrap-Select - Gitter
ERROR] AjaxBootstrapSelect : Cannot instantiate an AjaxBootstrapSelect instance without selectpicker first being initialized!
Read more >
Does ajax-bootstrap-select support liveSearch? - Stack Overflow
Yes I have initialised the bootstrap-select before ajax-selectpicker plugin. – Ribu. Oct 17, 2019 at 0:05. e.g. If I ...
Read more >
Ajax Bootstrap Select Test - CodePen
URL Extension Required. When linking another Pen as a resource, make sure you use a URL Extension of the type of code you...
Read more >
ajax-bootstrap-select - npm
A server that can process AJAX requests and send back appropriate JSON data. Bootstrap Select must either be be initialized with liveSearch ...
Read more >
Methods | bootstrap-select · SnapAppointments Developer
If you call val() on the element directly, the bootstrap-select ui will not ... To programmatically update a select with JavaScript, first manipulate...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found