DropDownTree show incorrect text when programmatically changing DataSource and selected value at the same time

.NET Version:.NET 8

Syncfusion Version:Syncfusion Blazor 24.1.41


The the following sample code,when click "Refresh Data" button,both DropDownTree and DropDownList should show text:"Shanna Sytsma".The DropDownList is correct,but the DropDownTree show incorrect Text,it's seem to show previous DataSource value and text.


@page "/"
@using Syncfusion.Blazor.Navigations
@using Syncfusion.Blazor.Buttons
@using Syncfusion.Blazor.DropDowns


<PageTitle>Home</PageTitle>


<h1>Hello, world!</h1>


Welcome to your new app.


<div style="margin-bottom:8px;margin-top:8px">
    <SfButton OnClick="RefreshData">Refresh Data</SfButton>
</div>
<div style="margin-bottom:8px">
    <SfDropDownTree TItem="EmployeeData" TValue="string" Placeholder="Select an employee" Width="500px" Value="SelectedValueDropDownTree">
        <DropDownTreeField TItem="EmployeeData" DataSource="Data" Id="Id" Text="Name" HasChildren="HasChild" ParentID="PId"></DropDownTreeField>
    </SfDropDownTree>
</div>
<div style="margin-bottom:8px">
    <SfDropDownList TValue="string" TItem="EmployeeData" Placeholder="Select an employee" Width="500px" DataSource="@Data" @bind-Value="SelectedValueDropDownList">
        <DropDownListFieldSettings Value="Id" Text="Name"></DropDownListFieldSettings>
    </SfDropDownList>
</div>
@code {


    List<string> SelectedValueDropDownTree { get; set; }
    string SelectedValueDropDownList { get; set; }


    List<EmployeeData> Data { get; set; }


    public class EmployeeData
    {
        public string Id { get; set; }
        public string Name { get; set; }
        public bool HasChild { get; set; }
        public bool Expanded { get; set; }
        public string PId { get; set; }
    }




    protected override Task OnInitializedAsync()
    {
        Data = new List<EmployeeData>
        {
            new EmployeeData() {Id="1", Name ="Dorotha Detten", HasChild=true, Expanded=true},
            new EmployeeData() {Id="2", PId = "1",Name ="Merilyn Borsh", HasChild=true, Expanded=true},
            new EmployeeData() {Id="3", PId = "2",Name ="Porsche Kral", HasChild=true, Expanded=true},
            new EmployeeData() {Id="4", Name ="Danita Pilant" },
            new EmployeeData() {Id="5", Name ="Florence Gruver"},
        };
        SelectedValueDropDownTree = new List<string>() { "3" };
        SelectedValueDropDownList = "3";
        return base.OnInitializedAsync();
    }


    public void RefreshData()
    {
        Data = new List<EmployeeData>
        {
            new EmployeeData() {Id="1", Name ="Tama Waldrop", HasChild=true, Expanded=true},
            new EmployeeData() {Id="2", PId = "1",Name ="Shanna Sytsma", HasChild=true, Expanded=true},
            new EmployeeData() {Id="3", PId = "2",Name ="Tamera Wordlaw", HasChild=true, Expanded=true},
            new EmployeeData() {Id="4", Name ="Charlotte Brighter"},
            new EmployeeData() {Id="5", Name ="Wanetta Bohanan"},
        };


        SelectedValueDropDownTree = new List<string>() { "2" };
        SelectedValueDropDownList = "2";
        this.StateHasChanged();
    }
}



The vs2022 sample project has upload to attachment.



Attachment: BlazorApp3_bc1db988.zip


2 Replies

SA SureshRajan Alagarsamy Syncfusion Team December 20, 2023 02:31 PM UTC

Hi Thomas,


Greetings from Syncfusion support.


We have reviewed your query and understanding that you are facing issue when dynamically updating value for the “value” property in the DropdownTree component. Upon further validation, we were able to replicate the reported issue. We have consider this as bug on our end. The fix for this issue will be included in the weekly patch release scheduled for January 03, 2024.


You can track the status of the fix through the following link.


Feedback : https://www.syncfusion.com/feedback/49414/issue-with-value-property-in-the-dropdowntree-component


Disclaimer : Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.


Regards,

Suresh.



TL Thomas Leung January 5, 2024 11:36 PM UTC

Hi  SureshRajan,

After update to version 24.1.44,the issue is fixed.


Thanks a lot!


Loader.
Up arrow icon