<div ng-app="listCtrl">
<div ng-controller="PhoneListCtrl">
<div id="Grid" ej-grid e-datasource="data" e-allowpaging="true" e-allowfiltering="true">
<div e-columns>
. ..
</div>
</div>
<script>
angular.module('listCtrl', ['ejangular'])
.controller('PhoneListCtrl', function ($scope) {
$scope.data = ej.DataManager({ url: "/odata/Orders", adaptor: new ej.ODataV4Adaptor() })
});
</script>
</div>
</div> |
MyDataDataContext db = new MyDataDataContext();
public object Get()
{
var queryString = HttpContext.Current.Request.QueryString;
int skip = Convert.ToInt32(queryString["$skip"]);
int take = Convert.ToInt32(queryString["$top"]);
var data = db.Orders.Skip(skip).Take(take).ToList();
return new { Items = data.Skip(skip).Take(take), Count = data.Count() };
}
<div id="Grid" ej-grid e-datasource="data" e-allowpaging="true" e-allowfiltering="true">
. .
. .
</div>
</div>
<script>
angular.module('listCtrl', ['ejangular'])
.controller('PhoneListCtrl', function ($scope) {
$scope.data = ej.DataManager({ url: "/api/Orders", adaptor: new ej.WebApiAdaptor() })
});
</script> |
[HttpGet] [ActionName("Get")] public object GetAll() { IQueryable<ProjectModels.Project.Dto> projects = this.projectProvider.GetAll(User.Identity.GetUserId()) .AsQueryable(); var queryString = HttpContext.Current.Request.QueryString; int skip = Convert.ToInt32(queryString["$skip"]); int take = Convert.ToInt32(queryString["$top"]); var data = projects.Skip(skip).Take(take).ToList(); return new { Items = data.Skip(skip).Take(take), Count = data.Count() }; }
public object Get()
{
var json = GlobalConfiguration.Configuration.Formatters.JsonFormatter;
json.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
if (order.Count == 0)
BindDataSource();
var data = order;
var queryString = HttpContext.Current.Request.QueryString;
int skip = Convert.ToInt32(queryString["$skip"]);
int take = Convert.ToInt32(queryString["$top"]);
data = data.Skip(skip).Take(take).ToList();
return new { Result = data, Count = order.Count() };
} |