Hello.
Is there any way to save default options of dropdown for further use?
I have a dropdown populated with a method but then in another callback i adjust those options and deleting some of them. When i reset values in another callbacks i would like to come back to initial options of dropdown.
you can always use a method in a callback (or a callback itself) to return your default value or you could store your default value in a global variable.
As far as I know global variable wont break anything. You need to store the default values somewhere if you dont want to query it from your DB. Dash wont magically know what your default values are to come back to them. I also don’t really know your use case, so I just throw possible ideas at you
You can use dcc.Store to store your default dcc.Dropdown options and call the data property to use them again.
But take care to use the same callback to fire the dcc.Dropdown option property to avoid problems of having two different callbacks Output on the same component.
Also the dcc.Store have different options to set the period of time and where the data will be stored: storage_type ( a value equal to: ‘local’, ‘session’, ‘memory’ ; default 'memory' ):