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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Custom Sort and Filtering Service

Thread ID:





145642 Jul 2,2019 07:52 AM UTC Jul 3,2019 11:09 AM UTC Angular - EJ 2 1
Tags: Grid
Asked On July 2, 2019 07:52 AM UTC

Hi Team,

Can I write my custom sort and filtering service which will generate query and that is compatible with WebApiAdaptor?

If yes, please explain how.


Thavasianand Sankaranarayanan [Syncfusion]
Replied On July 3, 2019 11:09 AM UTC

Hi Marko, 

Thanks for contacting Syncfusion support. 

From your query we suspect that you want to customize the default webApiAdaptor queryString with your own, while perform the sorting and filtering actions in Grid. So, we suggest to create the custom adaptor by extending the default webApiAdaptor to customize the default queryString. You can achieve this customer adaptor concept like as below code snippet, 

export class AppComponent { 
    public data: DataManager; 
    public pageSettings: Object; 
    public grid: GridComponent; 
    ngOnInit(): void { 
        this.data = new DataManager({ url: SERVICE_URI + 'api/Orders', adaptor: new customAdaptor }); // provide the customer adaptor in adaptor property 
        this.pageSettings = { pageCount: 3 }; 
class customAdaptor extends WebApiAdaptor { // create the custom adaptor by extending the default webApiAdaptor 
    public convertToQueryString(request: Object, query, dm: DataManager): string { 
       let res: string[] | string = []; 
        let table: string = 'table'; 
        let tableName: string = request[table] || ''; 
        let format: string = '$format'; 
        delete request[table]; 
        if (dm.dataSource.requiresFormat) { 
            request[format] = 'json'; 
        let keys: string[] = Object.keys(request); 
        for (let prop of keys) { 
            (<string[]>res).push(prop + '=' + request[prop]); 
        res = (<string[]>res).join('&'); // default queryString 
        if (dm.dataSource.url && dm.dataSource.url.indexOf('?') !== -1 && !tableName) { 
            return (<string>res); 
        // please customize the queryString here 
        return res.length ? tableName + '?' + res : tableName || ''; 

If we misunderstood your query, please provide more details about your requirement. This will help us to provide a better suggestion for your requirement as early as possible. 

Thavasianand S. 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon