We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Equality Comparison issue

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>
                </SfDropDownList>


6 Replies

GI Giannis May 7, 2023 10:16 PM UTC

Hello!

Is there any update?

Thank you



PK Priyanka Karthikeyan Syncfusion Team May 10, 2023 01:04 PM UTC

Hi Giannis,

Thank you for reaching out to us. Based on your shared information, it seems that we're having trouble understanding your requirements. In order for us to better assist you, could you please modify the sample that you shared according to your specific scenario, and provide us with the necessary steps to replicate the issue?

Additionally, if you could provide us with a video illustration sample, that would greatly help us in diagnosing and resolving the issue. We apologize for any inconvenience this may have caused you.

Best regards, Priyanka K


Attachment: ParameterAsync_(2)_c27027aa.zip



GI Giannis May 20, 2023 12:52 PM UTC

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?

Thank you.


Attachment: DropDownList_equality_problem_605daffb.rar



PK Priyanka Karthikeyan Syncfusion Team May 27, 2023 04:44 AM UTC

Hi Giannis,

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.

Regards,

Priyanka K


Attachment: ParameterAsync_(4)_c27027aa_bdb1ecc1.zip



GI Giannis June 3, 2023 05:50 PM UTC

I am sorry for the late response.

Yes that's exactly the problem. Was there any update about the issue?

Thank you



MR Mallesh Ravi Chandran Syncfusion Team July 20, 2023 08:26 AM UTC

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.


Regards,

Mallesh


Loader.
Up arrow icon