selectize.js
selectize.js copied to clipboard
How to disable caching?
Steps to reproduce:
- Open http://jsbin.com/bigijufike/edit?html,output
- Type:
java
- Select the first one
- Click the select and delete selected(
java
)
Expected result:
I need to preload some options by default, and delete selected back to the initial state(delete all the options that have been cached).
And each time the focus again to re request the interface, do not need to cache the results.
Actual result:
Is there any solutions? It is really bad? I use Selectize for cities, and use can put there more cities. He start type London, and select, ok. Then next he start type next city, and London is preloaded etc.
It would be nice to clear that cache, after selecting or after loading new sets from remote datasource
I have the same problem.
This looks like an issue to me, not a feature.
I'll report if I find a workaround.
Well, here's how I solved it for now, but don't know if you can use this approach in your case.
When I create my selectize instance, I use var instance = $('#element').selectize({...});
Since that happens every time I open a modal, when the modal is shown, I clear the value and the options with instance.selectize()[0].selectize.clear();
and instance.selectize()[0].selectize.clearOptions();
I also discovered that there are other properties that can help in this case, but I didn't need them:
instance.selectize()[0].selectize.renderCache['option'] = {};
and
instance.selectize()[0].selectize.renderCache['item'] = {};
i have the same issue, @aledmb i tried your solution in multiselect it clear old cached results but also selected items, is there any way to keep selected items?
This is breaking my search results. My search results are contingent not just on the search query, but other fields in my form. When I modify those and then repeat a search, I expect different results back. Please give us a way to disable caching :cry:
closing stale issues older than one year. If this issue was closed in error please message the maintainers. All issues must include a proper title, description, and examples.
I have the same problem as @mnpenner . Is there any solution?
@risadams I would like to disable cache or clear cache somehow.
Yes, this sounds like it should be fixed.
I will re-open and take a look when able, although my time is going to be limited for a while.
If there is anyone who would like to make a PR feel free.
@risadams I'm currently using selectize.clearOptions();
seems to solve the problem, but I don't know if it's the best solution.
I have a form with 3 fields, the selectize search depends on the values of the other fields. I programmed for when one of these fields has its value changed to clear the selectize and to clear the "cache" I used selectize.clearOptions();
It would be interesting to have a property that could disable this "cache"