Grid with drop down and binding using id field

Hi.
I'm looking at the following example to implement a drop down list in a grid: 
https://ej2.syncfusion.com/react/documentation/grid/how-to/provide-custom-data-source-and-enabling-filtering-to-drop-down-list/

In this example the grid data source isn't using the underlying country id as a reference, but uses the name (ShipCountry). I think a more common scenario would be using an id to reference data from the grid data source to the underlying drop down data source. So in this case the datasource.tsx would contain a value ShipCountryId for each entry that is a reference to the countryId in country variable in app.tsx. 
I found some (old?) references that used "foreignKeyField" and "foreignKeyValue", but I couldn't get it working. Is there an example that handles the scenario I described?
Thanks

3 Replies 1 reply marked as answer

TS Thiyagu Subramani Syncfusion Team November 18, 2020 04:02 PM UTC

Hi Alexander, 

Thanks for contacting Syncfusion forum. 

Based on your query we suspect that you need to store the country id value and need to display the ShipCountry name. To achieve this requirement we need to use the foreignKey column.  

Using foreignKeyColumn we can able to display the string data in the dropdown and store the number values in the grid datasource. For foreignKey column the values that you have defined in the mapping field names should be same, then only the required  foreignKeyField’s foreignKeyValue value will be shown in that column. 

For more information please refer the below demo and document link 



In this you also mentioned that foreignKey column is not working fine at your end. So, please share the following details, 

1.  Complete grid rendering code 

2.  Video demonstration of your requirement 

3.  If possible, share issue reproducing sample 

Please get back to us, if you need any further assistance. 

Regards, 
Thiyagu S 


Marked as answer

AE Alexander Esser November 18, 2020 05:50 PM UTC

Thanks, it worked. I was missing the the dataSource property.


TS Thiyagu Subramani Syncfusion Team November 19, 2020 04:30 AM UTC

Hi Alexander, 

Thanks for your update. 

We are happy to hear that the provided solution works at your end. 

Please get back to us, if you need any further assistance. 

Regards, 
Thiyagu S 


Loader.
Up arrow icon