Open kotowick opened 8 years ago
Hey there I had the same issue. After quite some time trying to get it to work, here is what I did:
best_in_place
like in this PR: https://github.com/bernat/best_in_place/pull/528. Hope it gets merged so you don't have do this.best_in_place
fields as a normal input. If you are doing something like multi select or tags (like I did), I would recommend you use the ok_button
and cancel_button
options since they will take away the blur event which is one less thing that can go wrong.= best_in_place @profile, :skill_list,
class: 'js-skill-list', inner_class: 'js-skills-input',
data: { tags: skills_collection },
ok_button: 'Save', cancel_button: 'Cancel'
best_in_place
, add this:$('.best_in_place').on 'best_in_place:activate', ->
$('input.js-skills-input').select2
tags: $('.js-skill-list').data('tags')
That's it. Now when the best_in_place
field gets activated, the Select2
will get initiated with whatever options you pass to it. When you click OK / Save, the input gets submitted like a normal text field (Do note the monkey patch though).
Trying to integrate best in place with Select2 (https://github.com/argerim/select2-rails). Anyone accomplish this?
Need it to work with select2 multi-select too..