Kendo Grid中的寻呼机错误(Nan-Nan of 1 items) [英] Pager error in Kendo Grid(Nan-Nan of 1 items)
本文介绍了Kendo Grid中的寻呼机错误(Nan-Nan of 1 items)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试创建一个包含学生详细信息列表的Kendo网格。点击添加按钮,寻呼机显示Nan-Nan of 1 items。
I am trying to create a Kendo grid with a list of student details. On click of the add button, the pager shows "Nan-Nan of 1 items".
@(Html.Kendo().Grid<Student.Models.StudentDetails>()
.Name("StudentDetailsGrid")
.Pageable()
.HtmlAttributes(new { id="StudentDetailsGrid"})
.Columns(col =>
{col.Bound(a => a.FirstName).Title("Name");
col.Bound(a => a.LastName).Hidden()
col.Bound(a => a.StudentID).Hidden();
col.Command(a => { a.Destroy(); a.Edit(); }).Title("");
}
)
.ToolBar(toolbar => toolbar.Create().Text("Add").HtmlAttributes(new {@id="btnCreateStudent"}))
.Editable(editable => editable.Mode(GridEditMode.InLine))
.Scrollable(scrol => scrol.Enabled(true))
.DataSource(source => source
.Ajax()
.PageSize(5)
.Model(a =>
{
a.Id(b => b.StudentID);
})
.Read(read => read.Action()
.Create(create => create.Action())
.Destroy(destroy => destroy.Action())
.Update(update => update.Action())
).Events(even => even.Save("SaveDetails").Edit("ChangeNoOfStudent").DataBound("StudentValidate")))
$ b $在Document.ready函数上的b
`
`
:
$(document).ready(function () {
$.ajax({
url: '../Student/GetStudentDetails?StudentId=' + Data.StudentId,
type: 'POST',
contentType: 'application/json',
dataType: 'json',
success: function (data) {
if (data.length > 0) {
var studentdetail = new kendo.data.DataSource({
data: data,
pageSize: 5
});
$("#StudentDetailsGrid").data("kendoGrid").setDataSource(studentdetail);
}
我添加了页面大小,但我仍然可以看到Nan-Nan of 1 items。
I have added the page size, but I can still see the "Nan-Nan of 1 items".
你能帮忙吗?
推荐答案
您需要在网格数据源中定义pageSize。不在成功函数中。
You need to define the pageSize in the grid data source. Not in the success function.
在您的情况下,您只需要在数据源中包含以下内容:
In your case you only need to include in your data source the following:
$.ajax({
url: '../Student/GetStudentDetails?StudentId=' + Data.StudentId,
type: 'POST',
contentType: 'application/json',
dataType: 'json',
pageSize: 10,
success: function (data) {...
我希望这会有所帮助。
更多信息请访问: Sudarsan Dash'blogs
I hope this helps. More information at: Sudarsan Dash'blogs
这篇关于Kendo Grid中的寻呼机错误(Nan-Nan of 1 items)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文