Hi Barbara,
Thanks for using Syncfusion products.
As from your query, we suspect that would like to update the data source when server updated. So, the grid Data manager will send the request to server side while calling the refresh method as you have used in your project for refresh the data source. But the corresponding post request will send to server side only if we bound the remote data source otherwise it won’t.
For your requirement, we have created a sample which can be download from following link,
In this sample, we have rendered the two buttons one for change the server-side data and another button to refresh the Grid in client side. Please refer to the following code example,
|
<script>
//button click function for change the datasource in server side
function serverData() {
var ajax = new ej.base.Ajax("/Home/ServerDataChange", "POST", true); // call API
ajax.send();
}
//button click function for change the datasource in client side
function clientData() {
var gridObj = document.getElementById("FlatGrid").ej2_instances[0];
gridObj.refresh();//referesh the Grid data
}
</script>
[Controller code]
public void ServerDataChange() {
int code = 10;
List<OrdersDetails> listToAdd = new List<OrdersDetails>();
listToAdd.Add(new OrdersDetails(code + 1, "ALFKI", 5, 2.3 , false, new DateTime(1991, 05, 15), "Berlin", "Simons bistro", "Denmark", new DateTime(1996, 7, 16), "Kirchgasse 6"));
. . .
OrdersDetails.GetAllRecords().AddRange(listToAdd);
} |
Note: If you are bound local data source to Grid then request won’t send to server side while calling the refresh method. Please refer to the above code example and sample for your reference.
If you still face the same problem, then could you please share the following details?
1) Share the Grid code example.
2) Are you binding remote data or local data?
3) If you are using local data, then we should handle the process of refresh data using AJAX post.
It would be helpful for us to find the problem and provide the better solution as earliest.
Regards,
Venkatesh Ayothiraman.