How to trigger DataManager reload when Url changes

Here is the list of actions I am trying to accomplish.

I have a data grid loading from an OData4 endpoint.

When a user selection of a variable changes, I construct the URL used by the DataManager.  Updating the URL does NOT trigger a reload of data.  Grid.Refresh() does NOT trigger reload of data from remote endpoint.

Currently I force a refresh by updating the Query.  I have a Guid Id, so I update the Query to new Query().Where("Id","notequal",Guid.NewGuid())
This does trigger the refresh and brings the records however it seems like a hack.  Another problem is that the grid is not cleared and there is now spinner as the data is being fetched and it's a problem, since it may take 2-3 seconds to return the new dataset.  I'd like the grid to go back to empty and show a spinner while waiting for data, so that the user is aware of something being done.  

What is the proper way to make the grid perform a call to a "new" OData endpoint (I call it new, since part of the url changes to reflect a changed parameter), trigger the call, while clearing the data and showing a spinner?  Thanks!

2 Replies

EK Edward Kagan May 22, 2020 07:20 PM UTC

I was incorrect.  Grid.Refresh does indeed reload from the newly created URL.  I think my only question is how to clear the Grid of records prior to it refreshing.


VN Vignesh Natarajan Syncfusion Team May 25, 2020 07:33 AM UTC

Hi Edward,  
 
Thanks for contacting Syncfusion support. 
 
Query: “Updating the URL does NOT trigger a reload of data.  Grid.Refresh() does NOT trigger reload of data from remote endpoint. 
 
From your query we understand that you want to change the Url of DataManager and refresh the Grid. You have mentioned that you are reconstructing the Url based on the user selection. Kindly confirm whether you are changing the entire Url or adding parameters to existing Url to filter / fetch specific data from server?.  
 
Because if you are reconstructing the existing Url with additional parameters, then you can achieve your requirement using Query property of Grid to send additional parameters to server. Refer our UG documentation for your reference 
 

If above solution does not resolve your query, kindly get back to us with following details.  

  1. Share the Grid code example.
  2. Share the details about your existing and reconstructed Url
  3. Are you facing any exception or script in browser console while refreshing the Grid.
  4. If possible share the issue reproducible sample.

Requested details will be helpful for us to validate the reported issue at our end and provide soluton as soon as possible.  
 
Regards, 
Vignesh Natarajan 


Loader.
Up arrow icon