Add Index to RowRenderEventArgs

In RadzenDataGridRow.razor can you pass it's Index parameter into Grid?.RowAttributes, and add it as a property on RowRenderEventArgs?

I'm trying to implement striping on a DataGrid with composite columns so that all the cells have the same background color, similar to this post.

I'm seeing that my OnRenderRow is called for each item twice. Item 1, Item 2, Item 3... then again 1,2,3... When there's an odd number of items there's a flash where the rows are striped one way, then striped another.

I'm not sure if this is a bug or not, but if you add Console.WriteLine(args.Data.OrderID); to the RowRender method on this demo page, you'll see each row is rendered, then each row is rendered again. Then sort a column and you'll see them rendered twice again.

Rows are rendered multiple times because of various reasons - Blazor prerendering is the most common. We will add the Index to the RowRenderEventArgs in our next update before the end of the week.

1 Like