Dynamic Generic Grid with Foreign Columns
Hi Support,
I'm trying to build a 'one size fits most' solution for my EF Core entities in my database. I'm creating a Blazor Server project so my DbContext is available locally and I'm using a custom data adaptor.
I've tried a few different ways to construct this grid and I do have it rendering at the moment with the following code:
```
```
I'm using reflection to find out the foreign key types and it builds the grid out.
```
```
The issue I'm having is the grid seems to be calling my custom data adaptor for the Foreign key column in what seems to be every single row of data. It's incessant and eventually crashes as it runs out of connections. I do not experience this when I define the columns in the component with a concrete object.
Currently I'm reverting to hard coding my grids but I was wondering if there was an elegant solution to this.
Thanks,
Joe
Hi Joseph,
Greetings from Syncfusion.
Before proceeding further with your requirement kindly share us the below details from your end.
- Share us the entire Grid code snippet.
- Share us whether the reported issue is due to using reflections or while using SfDataManager at your end.
- Kindly try the same by utilizing the datasource property of the foreignkey column and revert us if you faced the same issue at your end.
- Share us the video demonstration of the reported issue. Are you facing any browser console exception.
- If possible share us an simple issue reproduceable sample.
The above requested details will be very helpful for us to validate the reported issue at our end.
Regards,
Monisha
Thank you for your quick response. I got it working properly. Instead of using the builder for creating the foreign column field with reflection, I created a separate component class that takes the Foreign Entity as the TValue:
```
```
Then back in the builder code where I initialize the columns:
```
```
With that simple change, my DataAdaptor is now running only a couple of times at load.
Thanks for providing us with a great component set for Blazor!
Hi,
Welcome. We are glad to hear that the reported issue has been resolved at your end. Kindly get back to us if you have further queries. As always we will be happy to assist you.
- 3 Replies
- 2 Participants
- Marked answer
-
JM Joseph Murray
- Jan 22, 2024 10:45 PM UTC
- Jan 24, 2024 01:06 PM UTC