Trying to do row banding with latest nuget.
Took generated project with WeatherForecast and converted to Grid.
<RadzenContent Container="main" Style="padding: 0 !important; width: 100% !important;">
<ChildContent>
<div style="height: 100%; margin: 0 !important;" class="row">
<div class="col-md-12">
<RadzenGrid @ref="grid"
AllowFiltering="false"
AllowPaging="false"
AllowSorting="true"
FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive"
Data="@(forecasts)"
RowRender=@RowRender
TItem="WeatherForecast">
<Columns>
<RadzenGridColumn TItem="WeatherForecast"
Context="forecast"
Property="Date"
Sortable="true"
Bubble="false"
Filterable="true"
Title="Date">
</RadzenGridColumn>
<RadzenGridColumn TItem="WeatherForecast"
Context="forecast"
Property="TemperatureC"
Sortable="true"
Bubble="false"
Filterable="true"
Title="C">
</RadzenGridColumn>
<RadzenGridColumn TItem="WeatherForecast"
Context="forecast"
Property="TemperatureF"
Bubble="false"
Filterable="false"
Sortable="false"
Title="F">
</RadzenGridColumn>
<RadzenGridColumn TItem="WeatherForecast"
Context="forecast"
Property="Summary"
Sortable="false"
Bubble="false"
Filterable="false"
Title="Summary">
</RadzenGridColumn>
</Columns>
</RadzenGrid>
</div>
</div>
</ChildContent>
</RadzenContent>
@code {
protected RadzenGrid<WeatherForecast> grid;
private WeatherForecast[] forecasts;
protected override async Task OnInitializedAsync()
{
forecasts = await ForecastService.GetForecastAsync(DateTime.Now);
}
protected void RowRender(RowRenderEventArgs<WeatherForecast> args)
{
if (args.Data.TemperatureF > 60)
{
args.Attributes.Add("style", "font-weight: bold; color: red;");
}
}
}
The font-weight shows up, but no color.
On inspect the style does show up: style="font-weight: bold; color: red;"
Added to original code to:
style=@( forecast.TemperatureF > 60 ? "font-weight: bold; color: red;" : "")
It works fine.
What am I missing?
I do have the a the sample project as a zip fine but cant' seem to attach it.