I have used syncfusion grid::
<div id="Grid" ej-grid e-datasource="data" e-query="query" e-columns="columns" e-toolbarsettings='tools' e-toolbarclick="toolbarHandler" e-pagesettings="pagesttings" e-allowpaging="true" e-allowsorting="true" e-actionbegin="actionBegin" e-allowgrouping="true" e-enabledropareaanimation="false" e-groupsettings="grouping"></div>
var newColumns = [
{ field: "Id", headerText: "ID", width: 75, textAlign: ej.TextAlign.Right },
{ field: "Name", headerText: "Name ", width: 75, textAlign: ej.TextAlign.Right },
{ field: "Type", headerText: "Type", width: 75, textAlign: ej.TextAlign.Right },
{ field: "Kilogram", headerText: "Kilogram", width: 75, textAlign: ej.TextAlign.Right },
//{ field: "Category", headerText: "Category", width: 75, textAlign: ej.TextAlign.Right }
];
$scope.columns = newColumns;
$scope.data = ej.DataManager({ url: "http://localhost:49501/api/program/GetProgramFullListForSyncfusion", adaptor: "WebApiAdaptor" });
$scope.query = new ej.Query().addParams('selecedYear', '2014').addParams('accessId', '1');
$scope.pagesttings = { pageSize: 12, pageCount: 4 };
here is API method using which i have get data for grid::
public object GetProgramFullListForSyncfusion()
{
var queryString = HttpContext.Current.Request.QueryString;
int skip = Convert.ToInt32(queryString["$skip"]);
int take = Convert.ToInt32(queryString["$top"]);
string accessId = queryString["accessId"];
try
{
return new { result = ProgramService.GetFullListForSyncfusion(skip, take), count = ProgramService.GetActiveInactiveCount() };
}
catch (TimeoutException)
{
throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.RequestTimeout)
{
Content = new StringContent("An error occurred, please try again or contact the administrator."),
ReasonPhrase = "Critical Exception"
});
}
catch (Exception)
{
throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)
{
Content = new StringContent("An error occurred, please try again or contact the administrator."),
ReasonPhrase = "Critical Exception"
});
}
}
but grouping is not performed while drag the column
if i use loacal data then grouping is performed but not for data from api
above issue is solved, For WebApi Adaptor, return data as “Items” & “Count” instead of result and count