Allow to pass a Template to RadzenDataGrid when there is no data #164

Closed
opened 2026-01-29 17:32:38 +00:00 by claunia · 2 comments
Owner

Originally created by @MPapst on GitHub (Jul 24, 2021).

Is your feature request related to a problem? Please describe.
When dealing with Drag & Drop in the RadzenDataGrid on scope of rows, it is impossible to drop items on an empty data grid.
This works only if there can be drop callback attached to the empty row. As this is not yet supported natively, this can only be achieved using some workarounds.

Describe the solution you'd like
Allow to pass a Renderfragment as an empty Template for the Data Grid.

Describe alternatives you've considered
Wrapping the Data Grid completely in a drop zone makes it impossible to catch the rows itself later.
Attaching the RowRender Callback to the Empty Row could work (that is the way I am injecting callbacks to the drop for regular rows) but seems ugly, as there is no data item attached to the empty row.

Originally created by @MPapst on GitHub (Jul 24, 2021). **Is your feature request related to a problem? Please describe.** When dealing with Drag & Drop in the RadzenDataGrid on scope of rows, it is impossible to drop items on an empty data grid. This works only if there can be drop callback attached to the empty row. As this is not yet supported natively, this can only be achieved using some workarounds. **Describe the solution you'd like** Allow to pass a Renderfragment as an empty Template for the Data Grid. **Describe alternatives you've considered** Wrapping the Data Grid completely in a drop zone makes it impossible to catch the rows itself later. Attaching the RowRender Callback to the Empty Row could work (that is the way I am injecting callbacks to the drop for regular rows) but seems ugly, as there is no data item attached to the empty row.
Author
Owner

@enchev commented on GitHub (Jul 26, 2021):

You can set EmptyText to get single row when the DataGrid is bound to empty collection:
https://github.com/radzenhq/radzen-blazor/blob/master/Radzen.Blazor/RadzenDataGrid.razor#L272

@enchev commented on GitHub (Jul 26, 2021): You can set EmptyText to get single row when the DataGrid is bound to empty collection: https://github.com/radzenhq/radzen-blazor/blob/master/Radzen.Blazor/RadzenDataGrid.razor#L272
Author
Owner

@enchev commented on GitHub (Jul 26, 2021):

Hey @MPapst ,

I just saw your implementation and I've merged the pull request!

@enchev commented on GitHub (Jul 26, 2021): Hey @MPapst , I just saw your implementation and I've merged the pull request!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#164