Need to understand DataManager adapters and how to make a Custom One

Okay so here's a unique situation. I'll describe it carefully.

ASK: A custom adaptor that binds data to an external source using a function instead of a URL or query. 

or

ASK: A custom adaptor that uses query libraries such as Tanstack Query to retrieve the data from the source.

The reasons behind my ask:

  1. I build JS / React widgets inside the FileMaker app. This platform contains a web viewer object that renders HTML. 
  2. One can build a widget to get data from the surrounding FileMaker app and display it in some way.
  3. Since the web viewer is local to the FileMaker file that contains the data, the only way to get data from FileMaker is through a FileMaker script, which can be called by a JS function. 

It is great how Syncfusion works to bind the data, though I don't fully understand it. I'm trying to. It is my understanding that the DataMangaer handles the data. It handles all the fetching, updating, and refreshing as is necessary by various API calls. What the DataManager needs, I think, is an adaptor that allows for a function to be called. This async function could use any way to fetch the data. 

Maybe on a separate note, can any Syncfusion library use Tanstack Query to fetch and the refresh the data? I don't know how that would be since the DataManager does its thing to manage the data.

But since I can only use a Function to fetch data, I'm not sure if I can use the DataManager to keep the data bound to the component.

Can I use a current adaptor to fetch data via a function only, or is it possible to create one to do so?



3 Replies

JS Johnson Soundararajan S Syncfusion Team March 22, 2024 02:03 PM UTC

Hi Jeremy Brown,


The DataManager can connect to a remote data source by assigning the service endpoint URL to the 'url' property. The DataManager manages all interactions with the data server using queries. Different remote services have varying methods for accepting requests and returning responses.


The URL Adaptoror is employed when dealing with a RESTful API that adheres to a specific URL format for performing CRUD operations (Create, Read, Update, Delete). 


OData serves as a standardized protocol utilized for generating and utilizing data APIs online, enabling CRUD functionalities. This adapter manages incoming requests and outgoing responses in accordance with the OData protocol, encompassing tasks such as filtering, sorting, paging, and more.


OData V4 represents an updated iteration of the OData protocol, providing more features and improvements over the previous versions. It supports advanced querying capabilities and ensures compatibility with services that adhere to the OData V4 specification.


The Custom Adaptor enables you to establish your unique set of instructions for data retrieval, manipulation, and CRUD (Create, Read, Update, Delete) operations.


We reviewed your query, To create a custom adapter in Syncfusion that binds data to an external source using a function instead of a URL or query, you would need to extend the base `Adaptor` class and implement the necessary methods to interact with your data source.


Please refer to the below Documentation link more information.


Documentation link

Sample :  48qxqr (forked) - StackBlitz  


Please get back to us, if you need further assistance.  


Regards,

Johnson Soundararajan S



KS Karin Seifert-Lorenz September 23, 2024 01:45 PM UTC

I have the same questions, the reply is repeating the documents, which didn't help in the first place.

How can DataManager consume data from an async function and not an url?



AR Aishwarya Rameshbabu Syncfusion Team September 24, 2024 05:45 PM UTC

Hi Karin,


Based on the provided information, we have observed that you wanted to consume data from an asynchronous function rather than using a URL. In Syncfusion DataManager, each adaptor has its own structure, the URL property being essential for processing all server-side methods. Please refer to the given documentation link for more detailed information.


Before we can offer a solution tailored to your requirements, we need some additional information. Kindly provide the following details to help us deliver an optimal solution:


1. Details about the asynchronous function used, including the format of the returned data. Also please share your exact requirement in detail.

2. Specify the component to which you want to bind the resultant data from the custom data source and describe how you are binding the data to that specific component.

3. Information on the amount of data being returned by the asynchronous function.

4. If you are binding the data to a Syncfusion component, please share the complete rendering code of the component along with the version of the package in use.

5. Specify the data actions that you wish to perform with the component.


Providing these details will greatly assist us in sharing a more suitable solution for your requirement.


Documentation Link: Adaptors


Regards

Aishwarya R


Loader.
Up arrow icon