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

Fixing bugs for select2 editable #1015

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

angekouf
Copy link

xeditable was not working properly for me for select2 inputs. No value showed in select2 control after opening xeditable bubble.

I edited your final version to work for me properly.
I also changed the tpl for select2 to as the first one is depracated in the select2 docs and some select2 options were not working for me as expected for the input tag.

select2 for <input type="hidden"> is depracated and not working correctly for many features...
value2input was not working at all for me in a multiple select2 setup. No value showed in select2 control after opening xeditable bubble.

Firstly, why change the array of values to a joined string? Select2 accepts array as input for multiple/tagged select2, so join should be removed.

Secondly, since the select2 data are created with js during select2 initialization (no option tags exist in select tag in template), when setting the select value before initializing select2 nothing happens and the value always remains null (which was my problem). So I initialized the select2 if not already initialized and then I set the select2 value.

Now it works for me.
Changed the order of the fired event and the call to activating the control. 
Before thew select2 was activated and after the select2 dropdown was rendered the popover was repositioned when the show event was fired. However the  select2 dropdown position remained unchanged and the end placement was wrong.

With this fix the show event is fired (positioning the popover) before the callback to activating the element (that shows and positions the select2 dropdown)
@lk77
Copy link

lk77 commented Aug 29, 2017

hello,

there is some problems with your changes (i think, but perhaps it's before) when running grunt :

Running "jshint:js" (jshint) task
Linting src/inputs/select2/select2.js ...ERROR
[L292:C8] W099: Mixed spaces and tabs.
          this.$input.select2('open');
Linting src/inputs/select2/select2.js ...ERROR
[L296:C1] W099: Mixed spaces and tabs.
          if(this.$input && this.$input.data('select2')) {
Linting src/inputs/select2/select2.js ...ERROR
[L297:C1] W099: Mixed spaces and tabs.
              this.$input.select2('destroy');
Linting src/inputs/select2/select2.js ...ERROR
[L298:C1] W099: Mixed spaces and tabs.
          }
Linting src/inputs-ext/wysihtml5/wysihtml5.js ...ERROR
[L103:C8] W099: Mixed spaces and tabs.
          this.$input.data('wysihtml5').editor.destroy();

Warning: Task "jshint:js" failed. Use --force to continue.

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

Successfully merging this pull request may close these issues.

None yet

2 participants