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

Right Way to Change Options Dynamically #59

Closed
ncdram opened this issue Sep 3, 2021 · 4 comments
Closed

Right Way to Change Options Dynamically #59

ncdram opened this issue Sep 3, 2021 · 4 comments

Comments

@ncdram
Copy link

ncdram commented Sep 3, 2021

Hello,

Firstly, thanks for this great plugin. Works really well in most cases.

There is one problem we are stuck with, not sure if this use-case is supported. Details as follows:

  • We would like to dynamically change the options based on events that happen outside the select (for example some filtering options are chosen elsewhere, etc.)
  • We are fetching the new options using an Ajax call.
  • Since there was no explicit method defined to refresh the widget we tried to pass in the Ajax response data to the remoteSearchIntegrate function.
  • This updates the dropdown with the new data and works fine if there was no option selected before the refresh.
  • The problem is that if there is an option selected by the user it still continues to appear even though it is not part of the refreshed data (new set of options).
  • Note - We even tried to call .empty() before calling .remoteSearchIntegrate(data) - but even that did not fix the issue.

Could you please let us know if this use case is supported? If so, what is the best way to go about getting this to work?

Thanks in advance and great work once again.

@PhilippeMarcMeyer
Copy link
Owner

so sorry I did not see your question until tonight... 😓 yes i coded the remote part with the goal of keeping the already chosen options thru different searches. I will check soon and find a solution. very sorry for the late reply

@PhilippeMarcMeyer
Copy link
Owner

First of all ; the empty() function doesn't work well on 2 levels dropdowns
got to fix this
then got to code an changeTree call
see you soon

@PhilippeMarcMeyer
Copy link
Owner

the new v 0.76 will do it : check the ajaxDemo.html file : you will find 2 new button labelled "change tree" check the code

keep me informed please

cheers

philip Marc

@PhilippeMarcMeyer
Copy link
Owner

Maybe a remoteReload() method would be convenient instead of loadind data outside the plugin and passing it to ?
You would just have to modify the function parameters and call remoteReload()

on the other hand : using changeTree can be used with a local dropdown so it's a good feature

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

2 participants