[英]kendo grid paging does not work
如何在Kendo網格的total屬性中分配行號? 我用json填充數據:
if ($result = mysqli_query($con,$sql)) {
while($obj = mysqli_fetch_object($result)) {
$arr[] = $obj;
}
}
echo "{\"list\":" .json_encode($arr). "}";
但是分頁不適用於total = total或function! 我不知道我的電網問題在哪里!
$(document).ready(function () {
var record = 0;
var grid = $("#grid").kendoGrid({
dataSource: {
transport: {
read: {
url: "<?php echo $path?>/contractors.php?m=read&f=subcat",
dataType: "json"
}
},
schema: {
data: "list",
model: {
id: "id",
fields: {
company: { type: "string" },
firstname: { type: "string" },
lastname: { type: "string" }
}
},
total: function (response) {
return $(response.data).length;
}
},
pageSize: 20,
serverPaging: true
},
pageable: true ....
根據我在您的代碼中看到的, total
功能應為:
total: function (response) {
return response.list.length;
}
您從PHP返回的是一個JSON對象,該對象在名為list
的字段中包含一個array
,這是一個JSON對象(在KendoUI total
一次)。 因此,對該數組的引用是response.list
和長度response.list.length
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.