My DataGrid is defined with
Data="@activeSessions" and after pressing the Delete button I can confirm that the correct row is removed from the
activeSessions variable, but that change is not reflected in the DataGrid view. I have tried both with and without calling
StateHasChanged() but I see no difference.
Does anyone have any input that can point me in the right direction?
I did not get the same problem there. Instead, turns out I didn't fully understand how the updating of the page worked.
Basically, the problem was that I fetched the data from a database and stored it in a variable
myData. But I wanted to do some filtering on that before displaying it, so I transformed the data and stored it another variable
activeSessions which was used in the DataGrid. However I didn't do the filtering/transformation in
OnInitializedAsync when I fetched the data, but in the razor code just before I declared the DataGrid. So even though the removed row was deleted from
activeSessions, it was immediately replaced with the original data in
myData... Stupid me... :P
Anyway, thanks for the (rubberducking) help!