[英]jQuery Datatables Requested unknown parameter '0' for row '0' column '0'
I have the flat Json string produced by my aspx webpage.. 我有我的aspx网页制作的扁平Json字符串..
[{"UserName":"ABENS"},{"UserName":"AILPAL"},{"UserName":"ANDREW.GUILLERMO"}.....(so on so forth)]
I have declared the following html.. 我已声明以下html ..
<table id="tblUserAccountsManagement" class="display" cellspacing="0">
<thead>
<tr>
<th>UserName</th>
</tr>
</thead>
</table>
I have the following Jquery... 我有以下Jquery ......
$(document).ready(function () {
var tbl = $('#tblUserAccountsManagement').DataTable({
"ajax": {
"url": "AccountsManagementJSON.aspx",
"dataSrc": ""
},
"columns": [
{ "data": 'UserName' }
],
autofill: true,
select: true,
responsive: true,
buttons: true,
length: 10,
});
});
Why does it still output the error? 为什么它仍然输出错误?
Requested unknown parameter '0' for row '0' column '0'
行'0'列'0'请求未知参数'0'
I've read everything followed every troubleshoot there is, made sure that html and jQuery definition are intact.. why doesn't it still work? 我读过的一切跟着每一个解决存在,确信,HTML和jQuery的定义是完好的。为什么不它仍然工作?
What I don't understand is that I've tried this before here and it worked. 我不明白的是,我已经试过这之前,在这里,它的工作。 I only had to add
dataSrc: ""
and that did the trick. 我只需要添加
dataSrc: ""
就可以了。 I followed my previous example to the letter and now it does not work. 我按照前面的例子写了这封信,现在它不起作用。
What's weird is that it does show the number of rows (39 rows like in the JSON) But it won't show content. 奇怪的是,它确实显示了行数(39行像JSON中那样)但它不会显示内容。 Why is that?
这是为什么?
I have resolved the problem: I have used aoColumns
and mData
with this setup (Webforms with MasterPages). 我已经解决了这个问题:我使用了
aoColumns
和mData
这个设置(带有MasterPages的mData
)。
the following now works : 以下现在有效:
$(document).ready(function () {
var tbl = $('#tblUserAccountsManagement').DataTable({
"ajax": {
"url": "AccountsManagementJSON.aspx",
"dataSrc": ""
},
aoColumns: [
{ mData: 'UserName' }
],
autofill: true,
select: true,
responsive: true,
buttons: true,
length: 10,
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.