私は剣道の完全な初心者ですので、これは問題のように思えるかもしれません。剣道UIとWeb APIを使用してページングできない
私は、KendoUIとWeb APIを使用してサーバーサイドページネゴシエーションを実装しようとしています。
これは剣道グリッド
$(function() {
$("#grid").kendoGrid({
height: 400,
columns: [
"FirstName",
"LastName",
{ field: "Mobile", width: "150px" },
{ field: "Email", width: "150px" },
{ field: "LoginVerified", width: "150px" },
{ field: "DivisionName", width: "100px" }
],
pageable: true,
sortable: true,
filterable: true,
dataSource: {
serverPaging: true,
serverFiltering: true,
serverSorting: true,
pageSize: 10,
transport: {
read: "/api/Users/GetStaffsPaged"
}
}
});
});
を生成するための私のスクリプトであり、これは私のウェブAPI機能
[HttpGet]
[ActionName("GetStaffsPaged")]
public IEnumerable<StaffsBasicInfo> GetStaffsPaged()
{
var take = string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["take"]) ? 1000 : Convert.ToInt32(HttpContext.Current.Request.QueryString["take"]);
var skip = string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["skip"]) ? 1000 : Convert.ToInt32(HttpContext.Current.Request.QueryString["skip"]);
StaffsBasicInfoBL staffsBL = new StaffsBasicInfoBL();
List<StaffsBasicInfo> staffs = staffsBL.getAllStaffsBasicInfo();
staffs = staffs.Skip(skip).Take(take).ToList();
return staffs;
}
私は私のコードを実行すると、グリッドは常に最初の10件のレコードを示しているです、私のデータベースは2000以上のレコードを持っています。
私は、これを解決するためのチュートリアルの多くを試してみましたが、私は改ページを行うことはできません。
http://www.telerik.com/blogs/the-facts-on-using-kendo-ui-with-asp-net-webapi
上記のチュートリアルによると、私のコードは動作するはずです。
私もこのチュートリアルを試みましたが、私はVisual StudioでDataSourceクラスを解決できません。
http://blog.falafel.com/server-paging-sorting-filtering-kendo-datasourcerequest/
私は剣道がページネーション領域内のアイテムの合計/サイズ番号を生成することができるようにあなたが現在の項目の「合計」の数を返すされていないページネーション
ありがとうございました!出来た – Shuaib