Hi Francis,
Thanks for contacting Syncfusion support.
According to your requirement, you have try to perform server –side paging operation in Grid. To perform serve side operations(paging, filtering, sorting) in webapi adaptor, use ODataQueryOptions. ODataQueryOptions parameter in server side controller which contains all the required parameters for performing server side operations such as paging, sorting and filtering.
We have created a sample in Angular JS with Web API and please download from the following link.
Find the code example:
<div class="row">
<div ej-grid id="Grid" e-width="500px" e-datasource="data" e-allowgrouping="true" ------ >
<div e-columns>
-------------------------------
</div>
</div>
</div>
<script>
angular.module("GridCtrl", ["ejangular"])
.controller("bodyCtrl", function ($scope) {
//Provide the datasource to the grid. Here the WebApiAdaptor is used.
$scope.data = ej.DataManager({ url: "/api/Orders", adaptor: "WebApiAdaptor" });
$scope.tools = ["add", "edit", "delete", "update", "cancel", "search"];
});
</script>
---------------------------------------------
public PageResult<OrdersView> Get(ODataQueryOptions opts)
{
List<OrdersView> ord = db.OrdersViews.ToList();
return new PageResult<OrdersView>(opts.ApplyTo(ord.AsQueryable()) as IEnumerable<OrdersView>, null, ord.Count);
} |
Regards,
Prasanna Kumar N.S.V