Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

select2_simple_form and cocoon gem #14

Open
jsperezg opened this issue Feb 22, 2018 · 0 comments
Open

select2_simple_form and cocoon gem #14

jsperezg opened this issue Feb 22, 2018 · 0 comments

Comments

@jsperezg
Copy link

Good morning.

I'm using select2_simple_form in combination with cocoon in order to deal with nested models. The problem that I've foud is that each time a new nested record is added select2 inputs for this row do now correctly initializes the select2 inputs. I'm trying with this code, but without much success:

$("form").on("cocoon:after-insert", function(_, row) {
    var select = row.find('.place_scheduled_tasks_chemical_product_ids').find('select');
    if (select.length) {
      Select2SimpleForm.init({allow_html: true}, select);
    }
  });

How can I use the Select2SimpleForm class in order to initialize input added dynamically to a form? Is there a place where I can find any documentation regarding to it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant