Hi Kostiantyn,
Thanks for contacting Syncfusion support.
Query: “my SfGrid has DataSource=@list. When I remove some element from the list I don't have refresh my SfGrid and I see all list of elements with deleted element. How I can to fix it ?”
We have analyzed your query and we understand that you are facing issue with removed element(record) from datasource list. We suspect that you are facing this issue while removing the record (direct on Datasource property) on external action without using Grid built in DeleteRecord() method or Delete action.
If you are facing the issue in above scenario, then we would like to inform you that it is default behavior of the Grid. Changes done externally in datasource list will not reflect in Grid unless it refresh. So we suggest you to bind the data in the form of ObservableCollection. By default, for ObservableCollection changes done externally will be reflected in Grid automatically without any external action. But in case of IEnumerable or IQueryable list, changes done externally will not be reflected in Grid until datasource is refreshed.
So kindly use Refresh() method of Grid to reflect the changes into the Grid. Refer the below code example.
<SfButton OnClick="Remove" Content="Remove One List"></SfButton>
<SfGrid @ref="Grid" DataSource="@Orders" AllowPaging="true">
. . . . . .
</SfGrid>
@code{
SfGrid<Order> Grid { get; set; }
public List<Order> Orders { get; set; }
public void Remove()
{
Orders.Remove(Orders.FirstOrDefault());
Grid.Refresh(); // to reflect the changes in Grid
}
|
Refer our UG documentation for your reference
If above solution does not resolve your or if you are facing the reported issue with Grid built-in CRUD operation. Kindly get back to us with more details about the issue you are facing.
Regards,
Vignesh Natarajan