<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 };
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
every time call goes to api while drag a column or performing grouping
if i use local data then grouping is performed but not for data from api
public object Get() { … return new { Items = data.Skip(skip).Take(take), Count = data.Count() };
} |