skratchdot / react-bootstrap-multiselect

A multiselect component for react (with bootstrap). This is a react port of bootstrap-multiselect.
http://projects.skratchdot.com/react-bootstrap-multiselect/
Other
119 stars 61 forks source link

Require 'bootstrap-dropdown' causes conflict #39

Closed rockuw closed 8 years ago

rockuw commented 8 years ago

If I link bootstrap.min.js in my app(which I must do because I need other functionalities in bootstrap), this multiselect dropdown button DOESN'T work.

See http://stackoverflow.com/questions/35378368/bootstrap-sass-multiselect-event-conflict

It would be better to remove the require of 'bootstrap-dropdown' in this module and let the user link bootstrap.min.js instead:

if (typeof window !== 'undefined' && typeof document !== 'undefined') {
  //Necessary for Universal Javascript apps
  //since JQuery requires a working window
  var $ = require('./bootstrap-multiselect.js').init(
    require('./bootstrap-dropdown.js').init(
      require('jquery')
    )
  );
}
achtan commented 8 years ago

same issue here

wiiiim commented 8 years ago

same here

maximmuss commented 8 years ago

same here

skratchdot commented 8 years ago

Can everyone re-test with version 2.2.0? I slightly refactored the code. The bootstrap-dropdown check now looks like:

if (typeof jQuery.fn.dropdown !== "undefined") return jQuery;

So if you already have dropdown included, then the bootstrap v3.7 version won't be included.

See the first few lines of the file: https://github.com/skratchdot/react-bootstrap-multiselect/blob/master/lib/bootstrap-dropdown.js

Also, here's the gulp task that generates those files: https://github.com/skratchdot/react-bootstrap-multiselect/blob/dd44cc4683739eb88a7c22569dadbc1856fcd7e7/gulpfile.js#L59-L72

redkyo017 commented 7 years ago

I still got the error