gpt4 book ai didi

jQuery 数据表显示 NaN 条目中的 1 到 NaN

转载 作者:行者123 更新时间:2023-12-01 07:18:45 25 4
gpt4 key购买 nike

我在我看来使用了 jQuery Datatable,如下;

<table id="CategoryGrid">
<thead>
<tr>
<th>Id</th>
<th>
Name
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>

以及数据表的 javascript 代码;

    var catGrid = $('#CategoryGrid').dataTable({
"bPaginate": true,
"bServerSide": true,
"bProcessing": true,
"sAjaxSource": "@Url.Action("CategoriesGet")",
"aoColumns": [
{
"sName": "CategoryId",
"bSearchable": false,
"bSortable": false,
"fnRender": function (oObj) {
return '<a href=\"Company/Details/' + oObj.aData[0] + '\">View</a>';
}
},
{ "sName": "CategoryName" },
{ "sName": "CategoryDescription" }
]
});

返回的JSON数据如下;

{"sEcho":"1","iTotalRecords":10,"TotalDisplayRecords":10,"aaData":[["1","For Sale","asdfasdf"],["2","Jobs","asdfasdfasdf"],["3","Classes","asdfasdf"],["4","Vehicles","asdfasdsadfa"],["45","test","asdff"],["46","asfd","sdf"],["47","test","sdf"],["48","another test","sfsdfsdf"],["49","another test","sdfsdfsdf"],["50","asfd","asdf"]]}

为什么我会显示 1 到 NaN of NaN 条目

最佳答案

看起来您在 iTotalDisplayRecords 单词中出现了拼写错误,您忘记了 i 字母前缀...

另外,看看这个 Server-side processing

一般来说,来自服务器的回复应包含: iTotalRecordsiTotalDisplayRecordssEchoaaData 属性。 ..

sEcho : An unaltered copy of sEcho sent from the client side. This parameter will change with each draw (it is basically a draw count) - so it is important that this is implemented. Note that it strongly recommended for security reasons that you 'cast' this parameter to an integer in order to prevent Cross Site Scripting (XSS) attacks.

关于jQuery 数据表显示 NaN 条目中的 1 到 NaN,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16131831/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com