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

Select2 initialize duplicate component


Hi,
I've updated my project from 2.1.1 to 3.0.6.
I use select2 component as below
@Html.DropDownListFor(model => model.FirmId, new SelectList((System.Collections.IEnumerable)ViewBag.firmList, "Value", "Text"),
new { @id = "FirmSelect", @class = "form-select form-select-sm form-select-solid", @data_control = "select2", @style = "width:250px;", @onchange = "SelectFirm()", @required = "required" })

This creates 2 diffrent select2 component. One of them regular and works perfect. The other is duplicate and has no options and only a placeholder shown as "Select".
Why does it duplicates component.

I've updated my project according to Update Guidlines at https://preview.keenthemes.com/html/keen/docs/getting-started/updates

I have one more project that updated from 3.0.5 to 3.0.6 which works great.


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


Hi,

Could you please provide us with your test link? Probably you have 2 codes that initializes select2 twice. Please double check your code and make sure you remove Keen v2-related code that initializes Select2.

Regards.



Yep, you've got the point. happy I was looking for the second code that initializes... Finally found it. Thanks.



Hi happy,

Great! if you need any further help please do let us know.
All the best with your project!

Regards.


Your Support Matters!

We will highly appreciate your Metronic Review on Themeforest.
Please go to Themeforest Downloads page, select Metronic & leave your feedback.
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  :(