Mewriick / Blazor.FlexGrid

GridView component for Blazor
MIT License
198 stars 36 forks source link

Set row's CSS class depending on value of data item? #75

Open tobbi opened 4 years ago

tobbi commented 4 years ago

Is it possible to set the CSS class of the row depending on the value of one of the properties of my data row?

For example: If (row.IsValid) // Set CSS class "success" else // Set CSS class "failure"

Mewriick commented 4 years ago

@tobbi

Hello for now this is not supported scenario. For now you can create your own component which you can render into every column.

Example config.


 RenderFragment<Customer> customerEmailComponent = (Customer customer) => delegate (RenderTreeBuilder rendererTreeBuilder)
 {
     var internalBuilder = new BlazorRendererTreeBuilder(rendererTreeBuilder);
                 internalBuilder
                     .OpenElement(HtmlTagNames.H4)
                     .AddContent(customer.Email)
                     .CloseElement();
 };`