I have a dropdown list with complex objects and i use datamanager.
The object for example is User with Employee.
If the user that is bound to dropdownlist has the employee and the user in users list from the api does not
have the employee but its the same entity with the same ID it does not work.
If both have the employee or neither has it works just fine.
Why is that? Can i explicitly say that i want to compare IDs?
Thats the code bellow:
<SfDropDownList TItem="User" TValue="User" @bind-Value="Ticket.Creator">
<DropDownListFieldSettings Text="@nameof(User.Alias)" Value="@nameof(User.ID)"></DropDownListFieldSettings>
<SfDataManager Adaptor="Adaptors.WebApiAdaptor" Url="Authentication/Users/All" CrossDomain="false"></SfDataManager>
Is there any update?
As i am showing in the video attached bellow i have replicated the same control with the difference that in the first one i bind the ID and in the second i bind the entity.
When i bind the entity and for some reason i dont want to load all its properties when it does the compare if, in my situation, the Ticket.Creator (User) and the User from the Api call are not exact the same it doesnt make the connection as you can see.
On the other hand when i bind the ID it works just fine.
I hope that makes my problem clearer.
And my question is that when i want to bind the entity if there is a way to declare what i want to actually compare in an equality check?
We have prepared a sample based on the shared information. The value is not bound to the component when we remove the fields in the value binding, as shown in the video you shared. Could you please confirm if this is the issue you reported or if you are experiencing something else? We have attached the sample and video for your reference.
I am sorry for the late response.
Yes that's exactly the problem. Was there any update about the issue?
Hi Giannis ,
The Dropdown component's behaviour is designed such that the Value property must contain all the fields present in the DataSource item. When any of these fields are removed from the value binding, the component interprets it as a custom value, and as a result, the binding does not work as intended. So, you can set the Value property to contain all the fields present in the DataSource item.