Select2 multi-value: How to refresh -


I am using AJAX in Rail 4 to load this form. Using the Select2-rails gem, this document loads properly:

Image Details Here Enter

After clicking Update, it loads partial view:

 Enter the image details here

But when I click on the edit, the style is not visible, and only the default bootstrap style is displayed: < P> image description rate here H or

How do I get the final image to show select2 style from the first image? I think what to do with it is how the select2 style is loaded when the document loads for the first time, but appreciates the solution here: My stylesheet is here:

  $ (Document) .ready (function () {$ ("# e9"). Select2 ();})    

Allen:

Hello again ...

I had a similar problem in Rail 4 and had to do it with turbolinks.

Link:

Prepare your document for the function name below in your JS file, then add two commands just below the function, which are also below. This may also be your problem because your page loads properly initially, but when the turboilance is working, it tries to load only the first loaded files to speed up the load process And your document can skip the prepared function. Tell me if it helps ... (Jake - DBC).

var select2Gem = function () {$ ("# e9"). Select2 (); };

$ (document) .ready (select2Gem); $ (Document) .on ('page: load', select2Gem);

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -