- Home
- Forum
- React - EJ 2
- DataGrid is not refreshing after inserting a new Row
DataGrid is not refreshing after inserting a new Row
Hi,
I have a grid and used DataManager to bind the data to it as below:
const actionComplete = async (args: any) => {
if (args.requestType === 'save') {
console.log('save complete');
if (gridRef.current != null) {
console.log("refresh")
gridRef.current.refreshDataSource(null)
}
}
};
const baseUrl = import.meta.env.VITE_BASE_URL;
// Manage endpoint connections to backend via DataManager
const dataManager = new DataManager({
adaptor: new RemoteSaveAdaptor(),
json: data,
removeUrl: baseUrl + "AggComSys/RemoveLotControl",
updateUrl: baseUrl + "AggComSys/UpdateLotControl",
insertUrl: baseUrl + "AggComSys/StoreLotControl",
url: baseUrl + "AggComSys/GetLotControls?PlantNumber=" + plantNum,
});
When I try to insert a new row to the Grid, it works fine and it calls the API, however after returning Created by API to the grid, it does not refresh itself and does not show the new row. if I reload the whole browser page, it shows the new row.
Hi Hamidreza,
Greetings from Syncfusion support
After reviewing your shared information, we could see that
you are facing the problem of inserted records does not display in the Grid.
From validating your shared information, we could see that your DataManager
definition of RemoteSaveAdaptor and we could not identify your implementation
code part about the server-side CRUD actions.
So as per your shared information, we have prepared the sample and tried to
reproduce your reported problem, but the insert action was working fine at our
end. So, we suggest ensuring that the Insert method on the server side is
handled and returns the data in the following manner. please refer the below
code example, sample and video demo for more information.
|
HomeController.cs
public IActionResult Insert([FromBody]CRUDModel<BigData> value) { var order = BigData.GetAllRecords(); order.Insert(0, value.Value); return Json(value.Value); //ensure you are returning the data in this format. }
|
Sample and Video demo:
Since we are not identifying your implementation code part from your shared information, we need some more information for our clarification. So please share the below details that would be helpful for us to provide better solution.
1) Share your complete Grid rendering code (client and server code). We need to check your implementation.
2) Share your Syncfusion package version which was used in the React application and also Syncfusion NuGet package version.
3) If possible, share any issue reproducible sample or try to reproduce the issue with our shared sample.
Attachment: sample_and_video_abf3333b.zip
- 1 Reply
- 2 Participants
-
HS Hamidreza Shojaei
- Jun 17, 2024 05:13 AM UTC
- Jun 20, 2024 03:53 PM UTC