Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

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
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • 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
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(