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

Select Item with Ajax is removing Options #1549

Open
1 task
mcarpinter opened this issue Oct 7, 2020 · 3 comments
Open
1 task

Select Item with Ajax is removing Options #1549

mcarpinter opened this issue Oct 7, 2020 · 3 comments
Labels
pending review This issue was closed as stale; since then additional review has been requested.

Comments

@mcarpinter
Copy link

I did:

  • [x ] Search for if my issue has already been submitted
  • [x ] Make sure I'm reporting something precise that needs to be fixed
  • [x ] Give my issue a descriptive and concise title
  • Create a minimal working example on JsFiddle or Codepen
    (or gave a link to a demo on the Selectize docs)
  • [x ] Indicate precise steps to reproduce in numbers and the result,
    like below

I have a selectize dropdown that is loaded with Ajax at document ready. The options are well added, and can be selected by user.
But I have another function that loads the already selected option via another ajax when the modal (where the dropdown is) is shown, and after the options are loaded. But in doing so, all the options are removed from the dropdown.

I tried from the console this line:
jQuery('.targetSel.responsible').selectize()[0].selectize.addItem(912);
The idea was to select the corresponding option (that is the right value of one option of the dropwdown).

Steps to reproduce:

  1. Add options with AJAX at jQuery(document).ready()
  2. Open a modal that must have the dropdown
  3. Call a function where the modal is opened that uses .addItem() method to select the already saved items

Expected result:
The items saved on database are selected based on value

Actual result:
The options are removed

@github-actions
Copy link
Contributor

github-actions bot commented Jan 1, 2021

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

@mcarpinter
Copy link
Author

Any news or ideas on this?

@risadams risadams added pending review This issue was closed as stale; since then additional review has been requested. and removed no-issue-activity labels Jan 4, 2021
@risadams
Copy link
Contributor

risadams commented Jan 4, 2021

My apologies, I haven't been able to set up a demo yet to reproduce this.
If you are able to give us a codepen that would be great, otherwise it may take some time before I can take a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending review This issue was closed as stale; since then additional review has been requested.
Projects
None yet
Development

No branches or pull requests

2 participants