Blazor QuickGrid - Add class based on row item context property value
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 290
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Is your feature request related to a problem? Please describe the problem.
I need to add class to a row cell based on its value. Something like:
```
@inject DataSource Data
@code {
string GetClass(DateOnly birthDate) => birthDate.Year < 2000 ? "table-success" : "table-warning";
}
```
The item context property is not accessible within Class property of PropertyColumn.
I tried to use TemplateColumn, but it only works for the tag within the cell and not the entire cell itself.
```
@context.ToString("yyyy-MM-dd")
```
This also means that I have to manually handle sorting for the column which was automatically available through PropertyColumn tag.
### Describe the solution you'd like
There should be a CellClassFunc property in PropertyColumn which accepts a function with ItemModel as a parameter and string as return value.
The row item context should be accessible for that property.
### Additional context
The question was also raised on [StackOverflow](https://stackoverflow.com/questions/77585200/blazor-quickgrid-add-class-based-on-row-item-context-property-value)
Contributor guide
Assessment
This issue has not been assessed yet.