Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

Select2 to tree


Hello,

I am attempting to add a tree view using the Select2 plugin, and I have tried using the following plugin:

https://github.com/clivezhg/select2-to-tree

While this method works fine on a simple page, I am encountering an error when using it with metronic. The error message is as follows:


Uncaught TypeError: Cannot read properties of null (reading "trim")
at Utils.copyNonInternalCssClasses (plugins.bundle.js:14111:50)
at SelectionCSS.render (plugins.bundle.js:15579:13)
at DecoratedClass.render (plugins.bundle.js:13872:32)
at new Select2 (plugins.bundle.js:18830:38)
at HTMLSelectElement.<anonymous> (plugins.bundle.js:19737:26)
at Function.each (plugins.bundle.js:385:19)
at jQuery.fn.init.each (plugins.bundle.js:207:17)
at $.fn.select2 (plugins.bundle.js:19734:14)
at $.fn.select2ToTree (select2totree.js:41:21)
at (index):798:21



I would greatly appreciate any assistance in resolving this issue. Thank you in advance for your help.


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 (1)


Hi,

Have you tried this plugin with the latest version of Select2?
Could you please provide the code used with Metronic using https://gist.github.com/ ? How did you integrate it with Metronic build? Using gulp or webpack? This Select2 Tree plugin looks not updated for the last 2 years and most probably is not compatible with the latest Select2 version.

Regards.


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  :(