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

Bug select2 dropdown + search with x-editable #1127

Open
mulatmar opened this issue Apr 15, 2019 · 4 comments
Open

Bug select2 dropdown + search with x-editable #1127

mulatmar opened this issue Apr 15, 2019 · 4 comments

Comments

@mulatmar
Copy link

I click on the link. Popup opens with select. Click on select. The window is closed, select remains. I start typing text in the input field and select move to the top of the page.
https://monosnap.com/file/izwsEafdpS97aHnWuQeRXpu4CpxfRQ

@mlt
Copy link

mlt commented Jun 11, 2020

This is addressed here #1151 look at line 84 of the very last file (src/containers/editable-container.js) #574 has a cleaner patch. I confirm this behavior on Chrome. Everything works as is with Firefox.

Also consider using select2 4.x . It has dropdownParent so it can be hooked into popover used by x-editable. I have the following in my coffee script

Object.assign $.fn.editabletypes.select2.defaults,
  tpl: '<select></select>'
  select2:
    dropdownParent: '.popover'
    width: '20em'
    dropdownAutoWidth: true
    theme: 'bootstrap'

@oawebdev
Copy link

For inline mode:
dropdownParent: '.editable-inline'

@umurkaragoz
Copy link

select2 : {
      dropdownParent   : '.popover:last',
  }

If you have multiple select2 editables, and you click another select2 editable while one is already opened, existing .popover will be selected for parent just before it is deleted, and dropdown position will be miscalculated. Since the new .popover is appended to the body, it always ends up after the previous one. Therefore the solution would be adding :last to the dropdownParent selector, so it would always select the new .popover.

@ilramdhan
Copy link

For those of you who are struggling to implement it on Bootstrap 4, maybe this can help.

For Bootstrap 4 its work, check this #1189 (comment)

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

5 participants