[{"address":"507 - 20th Ave. E.\r\nApt. 2A","city":"Seattle"},{"address":"908 W. Capital Way","city":"Tacoma"},{"address":"722 Moss Bay Blvd.","city":"Kirkland"},{"address":"4110 Old Redmond Rd.","city":"Redmond"},{"address":"14 Garrett Hill","city":"London"},{"address":"Coventry House\r\nMiner Rd.","city":"London"},{"address":"Edgeham Hollow\r\nWinchester Way","city":"London"},{"address":"4726 - 11th Ave. N.E.","city":"Seattle"},{"address":"7 Houndstooth Rd.","city":"London"}]|
public object Get()
{
...
return Json(new { Items = data.Skip(skip).Take(take), Count = data.Count() });
} |
Hi LiuTzuYi,
Thanks for contacting Syncfusion support.
We have analyzed your query. We suggest you to return the values from the Get() method as Items and Count pair. Based on your requirement, we have prepared a sample to bind data to Grid using WebApiAdaptor. Please download the sample from the link below,Sample : http://www.syncfusion.com/downloads/support/directtrac/general/ze/EJ2-dotnet-core-758787007Please refer the code examples below,
public object Get(){...return Json(new { Items = data.Skip(skip).Take(take), Count = data.Count() });}
Documentation : https://ej2.syncfusion.com/16.1.37/aspnet/documentation/grid/databinding.html?syntax=tag#web-api
Please get back to us if you need further assistance.
Regards,Renjith Singh Rajendran.
{"items":[{"address":"507 - 20th Ave. E.\r\nApt. 2A","city":"Seattle"},{"address":"908 W. Capital Way","city":"Tacoma"},{"address":"722 Moss Bay Blvd.","city":"Kirkland"},{"address":"4110 Old Redmond Rd.","city":"Redmond"},{"address":"14 Garrett Hill","city":"London"},{"address":"Coventry House\r\nMiner Rd.","city":"London"},{"address":"Edgeham Hollow\r\nWinchester Way","city":"London"},{"address":"4726 - 11th Ave. N.E.","city":"Seattle"},{"address":"7 Houndstooth Rd.","city":"London"}],"count":9}|
<ejs-grid id="Grid1" allowPaging="true">
<e-data-manager url="/api/Orders/" adaptor="WebApiAdaptor" crossDomain="true"></e-data-manager> //Remove offline property
...
</ejs-grid> |
|
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMvc().AddJsonOptions(options =>
{
options.SerializerSettings.ContractResolver = new Newtonsoft.Json.Serialization.DefaultContractResolver();
});
} |