Unselect value on binded property

Hello.
I have a property in my grid wich is binded using foreign key to another entity. My grid display properly and, when editing, I get the drop down control to select the value as expected.
But the value for that column is nullable and after a value is selected I'm unable to unselect the element and set the value to null.
How should I manage this?
Thanks for the assistance.

5 Replies

VA Venkatesh Ayothi Raman Syncfusion Team September 26, 2018 06:30 AM UTC

Hi Toni, 

Thanks for contacting Syncfusion support. 

We have analyzed your query. But we are not certain about your exact requirement. We need more information to further proceed on this requirement. Please share with us the following details for better assistance. 

  1. Are you willing to show null values in the drop down shown during editing?
  2. Are you facing any issue like, you are selecting a value in dropdown and before updating that value in Grid, you click on cancel button. But the selected value in dropdown still updates in Grid?
  3. Share a video demonstration of the exact requirement/problem you are facing.
  4. Please share a detailed explanation of your complete requirement.
  5. Are you facing issue like, the value selected in dropdown is not updating in Grid?

The provided information will help us analyze the problem, and provide you a solution as early as possible. 

Regards, 
Venkatesh Ayothiraman. 



TO Toni September 26, 2018 10:53 AM UTC

Let's suppose we have a grid of customer data. One of the fields is the CountryId (which is linked to a table of Countries) but, maybe, this field is not informed (accepts null values).
    public class Customer
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public string Address { get; set; }
        public int? CountryId { get; set; }
    }
    public class Country
    {
        public int Id { get; set; }
        public string Name { get; set; }
    }

When we show the grid and use the ForeignKey attributes, the data is shown properly: the rows with the Country informed show their name and the rows with null values show nothing. This works perfectly.


Let's suppose now that, for any reason I want to come back the Country to null value in a row that has it informed. When I edit the row, the Country column shows a dropdown with all the available countries... but there's no option to select no value:

I miss an empty row (in fact, a caption, somethink like "Select option.,,"
Hope that now is more clear.
Regards


MF Mohammed Farook J Syncfusion Team September 27, 2018 11:26 AM UTC

  
Hi Toni, 

Thanks for contacting Syncfusion support. 

We have checked your query and we have tried to reproduce the issue at our end but it is unsuccessful. So we have prepared the sample “foreignkey with null values and edit option with dropdown.  Please refer the sample and screenshot for your reference. 
 

We have also prepared a issue not reproducing sample for your convenience. Please download the sample from the link below, 
 

If you are still facing the reported issue, please get back to us with the following details, 

1.       Share the Essential JS2 version details. 
2.       Share the full Grid code. 
3.       Share the data structure you are using. 
4.       If possible please reproduce the issue in the attached sample. 
The provided information will help us analyze the problem, and provide you a solution as early as possible. 

Regards, 
J Mohammed Farook 
 



TO Toni September 27, 2018 12:51 PM UTC

Well... I expected a caption that meant "no selection" but I will use this workaround.
Thanks for your assistance.


MF Mohammed Farook J Syncfusion Team September 28, 2018 07:32 AM UTC

Hi Toni,  
 
Thanks for your updated. 
 
Please use the given solution in the previous update.  
 
Please get back to us if you need further assistance. 
 
Regards, 
J Mohammed Farook 


Loader.
Up arrow icon