Connecting MongoDB database to angular grid

Hey there, I have tried going through all the methods in data binding documentaion but couldn't work it out. I am trying to get the the json data, comming from 'http://localhost:8000/api' in the dataSource( but no result is showing. Also, i am facing trouble trying to Connecting MongoDB database to angular grid by the api.


Attachment: api.service_c01564ca.rar

1 Reply

BS Balaji Sekar Syncfusion Team October 25, 2021 04:38 PM UTC

Hi Vijitha, 

Greetings from Syncfusion support 

Based on the query we could understand that your requirement is to fetch page-wise data from your API. For this we suggest you use the custom binding support available with the Grid to achieve the same. We have explained this in detail below, 

Custom binding: 

If you are using the API calls to perform Grid action from the server, then we suggest you to custom binding approach to bind data in the Grid. With this you can bind data from an API call by providing your own custom queries(as required by your API) and handle all the Grid actions(Search, Sort, Page, Filter, etc. ) with it. The Grid’s custom binding approach is explained below, 

For using custom binding, you need to bind the response data(Grid data) returned from your API as an object of result(JSON data source) and count(Total data count) properties and set it to the Grid’s dataSource property. On setting the data source in this format, the ‘dataStateChange’ event will be triggered with corresponding query for every Grid action performed like Searching, Paging, Sorting and Filtering.., and the ‘dataSourceChanged’ event will be triggered while performing CRUD action in Grid. So, using this you can send the queries in your required format to your API, process and return the result and then assign the returned result to the Grid’s dataSource property as an object of result and count properties. 

More details on custom binding can be checked in the below help documentation link, 



 
Regards, 
Balaji Sekar. 


Loader.
Up arrow icon