We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Tips on creating custom REST services as data source for Syncfusion controls (i.e. grid)

Thread ID:

Created:

Updated:

Platform:

Replies:

126442 Oct 14,2016 04:56 PM Oct 17,2016 08:11 AM JavaScript 1
loading
Tags: ejGrid
Tomasz Bednarek
Asked On October 14, 2016 04:56 PM

Hi all,

Could you please give some advice on using the JS controls bound to custom REST services? The potential services will be hosted within SharePoint, which shouldn't change much. They're  just WCF REST methods returning JSON data written in C#.

What interests me:
  1. What format of data is expected by the JS grid control?
  2. How to parse the query parameters i.e. for paging, sorting, grouping etc. Are there any helper classes for this task or should everything be coded from scratch?
  3. How do the possible components (eg. grouping button) translate to query parameters?
Should you know anything about the mentioned matters or can lead me on some further reading, please respond.

Appreciate,
Tomasz

Venkatesh Ayothi Raman [Syncfusion]
Replied On October 17, 2016 08:11 AM

Hi Tomasz, 

Thank you for contacting Syncfusion support. 

By default, the Grid would play well with REST services. Because we have default data adaptor is OData adaptor and WCF REST services uses also OData adaptor. So, our Syncfusion Grid control works well with WCF API. 
Query #1: “What format of data is expected by the JS grid control?” 
If your using OData version 3 then we can bound the data using ej.DataManager with url without specifying any adaptors. For eg. dataSource: ej.DataManager({ url: "place url here" }); . The grid accepts the both JSON light format and verbose format of the OData V3. 
If you are using OData v4 then we should specify the data adaptor as ej.ODataV4Adaptor as specified below,  
dataSource: ej.DataManager({ url: "place url here" }, adaptor:"ODataV4Adaptor");  
Query #2: “How to parse the query parameters i.e. for paging, sorting, grouping etc. Are there any helper classes for this task or should everything be coded from scratch? 
The Grid`s datamanager will build URL based on all Grid actions like paging, sorting, filtering and grouping. For example the request URL generated from Grid, when performing paging is as follows. 
../Northwnd.svc/Employees/?$inlinecount=allpages&$skip=0&$top=5 
The REST services should have capable of capturing the query params from URL and performing  actions in Server side.  
 
Query #3: “How do the possible components (eg. grouping button) translate to query parameters?” 
 
We have unclear about your requirement. if you have mentioned about Syncfusion Grid grouping button or Grouping Button control in JS.  If Grid grouping button, then it will also handle by source level and modified the URL depends upon clicking the grouping button in Grid or please share the more details about your requirement. 
 
Regards, 
Venkatesh Ayothiraman. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;