dropdown list in dialog not updating

I have a dialog box with 2 dropdown lists. When I select a value from dropdowlist1 it should update dropdownlist2. The changeevent does fire and update the datasource; however, the dropdownlist2 does not refresh with the new data. I do call StateHasChanged after the list is updated but after some research, I understand that it only applies to the parent.

How do I refresh a component on a blazor dialog? Maybe there should be a dialogComponent.StateHasChanged() but I do not see one in version 20.4.0.52.


Thanks Richard


4 Replies

RR Richard Rooks January 8, 2024 04:54 PM UTC

Solved my specific problem by using ObservableCollection as a datasource.



KP Kokila Poovendran Syncfusion Team January 9, 2024 08:13 AM UTC

Hi Richard Rooks,


We delighted to hear that you were able to resolve your specific problem by utilizing ObservableCollection as a datasource. If you encounter any further concerns or have additional queries, please don't hesitate to reach out to us. We're here to assist you!


Regards,

Kokila Poovendran.



SP Scott Peal October 24, 2024 05:26 PM UTC

I also had this issue and solved it by calling dialog.Hide and then dialog.Show; unfortunately it gives a bad user experience with a flicker. Hey Devs, we really need a dialog.RefreshState method please. I have a dropdown which sets a variable value. Based upon that value certain fields are shown or not. 



UD UdhayaKumar Duraisamy Syncfusion Team October 25, 2024 08:28 AM UTC

If the data source for the Dropdown List component is updated dynamically, such as when Dropdown List 2's data source depends on a selection in Dropdown List 1, you'll need to call the RefreshDataAsync method on Dropdown List 2. This method refreshes the popup list items, making it especially useful when the list items change due to external updates.


For more information, refer to the Blazor API Reference for DropDown List.


Loader.
Up arrow icon