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:
After clicking Update, it loads partial view:
But when I click on the edit, the style is not visible, and only the default bootstrap style is displayed: < P>
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
Post a Comment