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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

use Paging in ejGrid by using POST request

Thread ID:

Created:

Updated:

Platform:

Replies:

121900 Feb 5,2016 07:36 AM UTC Feb 8,2016 10:05 AM UTC JavaScript 1
loading
Tags: ejGrid
Myungjin Cho
Asked On February 5, 2016 07:36 AM UTC

Hello Syncfusion.
Currently, I am trying to make the paging in ejGrid work by using client-server request.
I want to display only 10 rows per each page by requesting to the server.
So far .. this worked
var dataManager = ej.DataManager({
url: "${pageContext.request.contextPath}/beacon/test/sync/getStoreListSync.do"
, adaptor: new ej.UrlAdaptor()
});
dataManager.executeQuery(new ej.Query()).done(function (e) {
$("#Grid").ejGrid({
dataSource: e.result.result,
allowPaging: true,
pageSettings: { enableTemplates: true, template: "#template", showDefaults: false },
create : function (args) {
$("#btn").ejButton({
click : "btnClick"
});
},
columns: [
{ field: "storeName", headerText: '', textAlign: ej.TextAlign.left },
{ field: "storeType", headerText: '', textAlign: ej.TextAlign.left },
{ field: "parGroupName", headerText: '', textAlign: ej.TextAlign.left },
{ field: "storeDesc", headerText: '', textAlign: ej.TextAlign.left },
]
});
});

but it does't seem to make the paging work even though I respond the request with the class
public class DataResult {

public List result;
public int count;
public List getResult() {
return result;
}
public void setResult(List result) {
this.result = result;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
}

The count has no effect what so ever and seems to only rely on the array which is given from the start, and when I try the different method
which is in the document
$("#Grid").ejGrid({
dataSource : ej.DataManager({
url : "../sync/getStoreListSync.do",
updateUrl : "Home/Update",
insertUrl : "Home/Insert",
removeUrl : "Home/Delete",
adaptor : "UrlAdaptor"
}),
allowPaging : true,
editSettings : {
allowEditing : true,
allowAdding : true,
allowDeleting : true
},
columns : [
{ field: "storeName", headerText: '', textAlign: ej.TextAlign.left },
{ field: "storeType", headerText: '', textAlign: ej.TextAlign.left },
{ field: "parGroupName", headerText: '', textAlign: ej.TextAlign.left },
{ field: "storeDesc", headerText: '', textAlign: ej.TextAlign.left },
]
});

The server cannot catch the request from the client.
Are there any solutions to this problem, and what have I missed?
Thank you

Prasanna Kumar Viswanathan [Syncfusion]
Replied On February 8, 2016 10:05 AM UTC

Hi Maveri,

Thanks for contacting Syncfusion support.

To perform server-side paging operation, we suggest you to use the PerformSkip and PerformTake methods in the server-side. To get dataManager value, we need to refer the Syncfusion.EJ dll in the sample.

Please find the code example and sample:


public ActionResult DataSource(Syncfusion.JavaScript.DataManager dm)

        {

            IEnumerable Data = OrderRepository.GetAllRecords();

            Syncfusion.JavaScript.DataSources.DataOperations operation = new Syncfusion.JavaScript.DataSources.DataOperations();

            int count = Data.AsQueryable().Count();

            if (dm.Skip != 0)

            {

                Data = operation.PerformSkip(Data, dm.Skip);

            }

            if (dm.Take != 0)

            {

                Data = operation.PerformTake(Data, dm.Take);

            }

            return Json(new { result = Data, count = count }, JsonRequestBehavior.AllowGet);
        }


Sample: http://www.syncfusion.com/downloads/support/forum/121900/ze/Sample1185771106186665

DLL Location: C:\Program Files (x86)\Syncfusion\Essential Studio\13.4.0.53\Assemblies

For more information, please refer to the following knowledge Base documentation,

https://www.syncfusion.com/kb/4300/server-side-api-for-datamanager-operations

Regards,
Prasanna Kumar N.S.V


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.

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

;