Get 2024 Templates Mega Bundle!$1000 worth of 19 Bootstrap HTML, Vue & React Templates + 3 Vector Sets for just $99
Get for 99$

Jstree and select2 conflict


Hi,

Im using jstree and a modal with select2 dropdown, and whenever i load the jstree.bundle.js select2 gets an error "select2 is not a function". I'm using the plugins.bundle.js which contains the select2 function which is above the jstree.bundle.js. What can i do to fix this?


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (4)


Hi,

In our build, it seems JSTree works fine. You can check it here. Please note that Select2 is globally included in the plugins.bundle.js.

May I know your Metronic version?

Regards.



Hi thanks for the reply, is there an example where jstree and select2 are on the same page? It seems that whenever i load jstree.bundle.js select2 does not work.



Hi,

I just tested Select2 with jStree with the latest Metronic 8.3.2 and it worked well:

<img src="https://i.imgur.com/7KTXGRE.png" alt="">

Please make sure that you include assets/plugins/custom/jstree/jstree.bundle.js after the assets/plugins/global/plugins.bundle.js.

Regards,
Sean



Hi,

I am using metronic version 8.1.8 and facing with same problem, do you have any suggestion?


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(