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

Server side processing

Hi, could you give an example of the server side processing? I have big data set I want to process all actions on the server. Under actions, I mean paging, sorting, and filtering. I created test grid, it's working, but it doesn't send any requests to the server when I click sort or anything else. I don't know how to trigger it. Could you give an example what will send to the server and how I need to prepare the response, something like this https://datatables.net/manual/server-side? Thank you
My test code:
        var dataManager2 = ej.DataManager({
url: "/attribute-set/grid",
crossDomain: true
dataManager2.adaptor = new ej.UrlAdaptor();
var query = new ej.Query().take(5);
var dataObj = dataManager2.executeQuery(query); //Request the webservice
dataObj.done(function (e) {
dataSource: e.result.results,
allowPaging: true,
allowSorting: true,
allowFiltering: true,
columns: ["ID", "CreatedAt", "DeletedAt", "UpdatedAt", "Name"],

5 Replies

SA Saravanan Arunachalam Syncfusion Team September 5, 2017 04:40 AM UTC

Hi Vasily, 
Thanks for contacting Syncfusion’s support. 
We have analyzed your provided code and you have set the dataSource of Grid as return data (Json) instead of set the ejDataManager instance which is the cause of the issue. Please refer to the below code example to overcome your reported issue. 
$(function () { 
        var dataManager = ej.DataManager({ url: "/Home/DataSource", adaptor: new ej.UrlAdaptor() }); 
            dataSource: dataManager, 
            allowPaging: true, 
            filterSettings: {filterType: "menu"}, 
            allowFiltering: true, 
            allowSorting: true, 
            columns: [ 
                    { field: "OrderID", isPrimaryKey: true, headerText: "Order ID" }, 
                    { field: "EmployeeID", headerText: 'Employee ID' }, 
                    { field: "CustomerID", headerText: 'Customer ID' }, 
                    { field: "Freight", headerText: 'Freight', format: "{0:C}" }, 
                    { field: "ShipCity", headerText: 'Ship City' }, 
And also we have created a sample based on your requirement that can be downloaded from the below link. 
And also refer the following knowledge base document to know more about server side data operation. 
Saravanan A.       

VA Vasily September 5, 2017 02:07 PM UTC

Thank you, it's working. It will be good to have info about server response somewhere in the documentation. In my case, it didn't work because I didn't know how to prepare server answer.

Server response should be a JSON which contains two fields:

count - a total of found records
results - an array of your columns data

Is it right?

SA Saravanan Arunachalam Syncfusion Team September 6, 2017 05:54 AM UTC

Hi Vasily, 
Yes, we should return the data from server like object (which contains result and count) while using UrlAdaptor (DataManager instance) as a dataSource of Grid control. 
Saravanan A. 

VA Vasily September 6, 2017 11:59 AM UTC

Ok, thank you

SA Saravanan Arunachalam Syncfusion Team September 7, 2017 06:12 AM UTC

Hi Vasily,  
Thanks for your update.            
We are happy that the provided information helped you. 
Saravanan A. 

Live Chat Icon For mobile
Up arrow icon