โ03-18-2022 04:57 AM
I have created a dropdown (say B) in my notebook whose input depend on dropdown( say B). So if select some value in dropdown A, it corresponding value appears in B dropdown & i'm selecting one amongst it. Now if i change the value in dropdown A, then Value in drop B is also changing but the one previously selected is still there. Is there any way if i cab refresh that dropdown.
โ03-22-2022 10:37 AM
Hi @sagar Varmaโ ,
This link has a step-by-step description. Please go through it and share your amazing idea. Here you go !
โ03-22-2022 06:45 AM
Hi @sagar Varmaโ ,
Please read these docs:-
Hopefully they'll help you or else you can always come back with a NO !
โ03-22-2022 09:09 AM
Hi @Kaniz Fatmaโ ,
โ
I tried and explored all the documents before raising question here, but none of them has solution for my problem. There after i relaize that like remove widget we must have reset widget option as well, which will reset it to its default value, as we are providing it during its creation.โ
โ03-22-2022 09:56 AM
Nice observation @sagar Varmaโ !
Would you like to raise a request on our Ideas portal?
โ03-22-2022 10:28 AM
Yes, @Kaniz Fatmaโ I would like to raise a request on ideas portal.โ
โ03-22-2022 10:37 AM
Hi @sagar Varmaโ ,
This link has a step-by-step description. Please go through it and share your amazing idea. Here you go !
โ04-26-2022 03:39 PM
Hi @sagar Varmaโ , Just a friendly follow-up. Do you still need help, or were you able to raise a request on the ideas portal? Please let us know.
โ03-16-2023 06:06 AM
If the previously selected value of B is not meant to be in the list of values for newly selected dropdown A value, then you could set a default value (ie: 'No selection') that the B dropdown should have when first created. In a method to define how you create B, check if current B value is not valid for A, if it is not then create the dropdown widget with the default value.
If the value of B makes sense also when dropdown A changes, try to find a way to figure out if A changed. For example write the code to create B in a cell where you also call dbutils.widgets.get(A). This will run the cell when A changes, then create B with the default value. When running the cell that checks if A changed, also write create_B (input_values, 'No selection').
It's complicated, but follow the logic and you will get there.
def create_B (input_values, default):
values = [value for value in input_values]
if (default not in values):
default = 'No selection'
if ('No selection' not in values):
values.insert(0, 'No selection')
dbutils.widgets.dropdown('widget B', default, values)
Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections.
Click here to register and join today!
Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.