Creating a reusuable Grid component

I have multiple SfGrid components all throughout an app and I would like to standardize their use, with things like shared settings, toolbar, etc in a way that I wouldn't have to specify these every time but could do something like <MyCustomSfGrid /> instead. I'd like to still leave room for custom columns and templating based on the page/type the grid is using. Is there a way to do this? I've been messing around with RenderFragments for each section such as GridColumns but the columns don't see to retain their information


1 Reply

SP Sarveswaran Palani Syncfusion Team November 8, 2023 04:55 PM UTC

Hi Josh,

Greetings from Syncfusion support.

From your query, we suspect that you want to render multiple grids in your project. We suggest you to create a custom Grid component by rendering the SfGrid as a new razor component. It helps to create your own custom component when you want to create multiple grids with same configuration or with default configuration throughout your application. We have attached the sample and UG documentation link for your reference.

Reference: https://blazor.syncfusion.com/documentation/datagrid/how-to/create-custom-grid-component

Regards,
Sarvesh


Attachment: SfGridCustomComponent_8038f89e.zip

Loader.
Up arrow icon