Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

How to update MudDataGrid after onchange trigger?

$
0
0

I have a MudDataGrid defined loosely as this:

<MudDataGrid @ref="_dataGrid" Virtualize="true" Dense EditMode="DataGridEditMode.Cell" ReadOnly="false" T="InmodeloReposicion" Items="@modeloRepoDisp" SortMode="SortMode.Multiple" Filterable="true" Hideable="true" HorizontalScrollbar="false" FilterMode="@DataGridFilterMode.ColumnFilterRow" FilterCaseSensitivity="DataGridFilterCaseSensitivity.CaseInsensitive" @bind-SelectedItem="selectedItem">...<PropertyColumn Property="x => x.VentaMes12" Title="Venta Mes 12" IsEditable="false" CellStyle="max-width: 100px;" CellStyleFunc="_cellStyleFunc12" /><TemplateColumn Title="Venta Atípica"><EditTemplate Context="product"><MudTextField T="int?" Value="@product.Item.ValoresAtipicos" Immediate="true" ValueChanged="@(newValue => ValChanged(newValue, product.Item) )" /></EditTemplate><CellTemplate Context="product">@product.Item.ValoresAtipicos</CellTemplate></TemplateColumn>...</MudDataGrid>

and the ValueChanged method:

    private void ValChanged(int? value, InmodeloReposicion a){        try        {            a.ValoresAtipicos = value;            a.Mes12 = value;            decimal? valores = a.ConsumoPromPorDia - a.ValoresAtipicos;            a.ConsumoPromPorDia = Math.Max(a.ConsumoPromPorDia - a.ValoresAtipicos ?? 0, 0);        }        catch (Exception)        {            throw;        }        StateHasChanged();    }

Where Items is a list that is populated on a click button and is on-memory. On this grid I have a column that gets a number value and updates other values on other columns as in Venta Mes 12 but if I try updating the value it doesn't do anything.

I've tried adding StateHasChanged to no avail


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>