Real time syncing of data with backend.

I am new using treegrid and need to integrated this treegrid component with a backend but the data needs to be updated in the real-time i.e, multiple users can edit the component and edits should be reflected to all users ASAP. What are the techniques I can use to achieve this and more can you link me the docs that explain the process. I must use sockets.io (clients requirement) in order to achieve real time syncing.


3 Replies

PS Pon Selva Jeganathan Syncfusion Team February 2, 2022 11:48 AM UTC

  
Hi Nitesh, 
 
Thanks for contacting syncfusion forum. 
 

Query : Real time syncing of data with backend

 
Based on your query, we suggest you use the remoteSaveAdaptor with CRUD operation of the treegrid. RemoteSaveAdaptor is extended from the JsonAdaptor of the DataManager and it is used for binding local data and perform all Tree Grid Actions in client-side except the CRUD operations, that should be interacted with server-side to persist data 
 
While using remoteSaveAdaptor, CRUD operations can be mapped to server-side using updateUrlinsertUrlremoveUrl and batchUrl properties, and Datasource must be set to json property 
 
Please refer to the below help documentation, 
 
Kindly get back to us for further assistance. 
 
Regards,   
Pon selva   





NR Nitesh Raut February 10, 2022 09:55 AM UTC

Hey there I am trying to use the RemoteSaveAdaptor for my case and came across few issues.


How do I fetch the initial data using the RemoteSaveAdaptor ?

How can I update data with specific Id ? 

The above is the route where I perform update operation but I need to send ID ​too as the backend expects one but the RemoteSaveAdaptor is sending requests on the updateUrl only without no id.



PS Pon Selva Jeganathan Syncfusion Team February 11, 2022 04:55 PM UTC

Hi Nitesh, 
 
Thanks for the update. 
 

Query : How do I fetch the initial data using the RemoteSaveAdaptor ?

Initially you can bind the data using json property of datamanager.

Please refer to the below code snippet,

 this.data = new DataManager({ 
    json: JSON.parse(this.value), 
    …. 
    .. 
    adaptor: new RemoteSaveAdaptor(); 
}); 

Please refer to the below help documentation, 
 
Query: How can I update data with specific Id ?  
 
Based on your query, we suggest you modify the url in action begin event of the treegrid. 
 

Please refer to the below code snippet,

 function actionbegin(args) { 
    if (args.requestType == "beginEdit") {  
location.replace(window.location.rel='nofollow' href + "Home/Update/" + args.primaryKeyValue) // here you can change the url 
 
    } 
 
 
Please refer to the below code snippet, 
 
If does not meet your requirement, If it does not meet your requirement kindly share the detail explanation of your requirement and share the front end and back end language details. 
 
Kindly get back to us for further assistance. 
 
Regards,   
Pon selva   




Loader.
Up arrow icon