我在datatable上得到了这条错误消息。请帮我解决这个问题。 [英] I got this error message on the datatable.please help me to resolve this issue.
本文介绍了我在datatable上得到了这条错误消息。请帮我解决这个问题。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
function RefreshSearchResult(location, provider, reason, from, to, chartNumber) {
debugger;
var str = "{ strLocation:'" + location + "', strProvider: '" + provider + "', strReason: '" + reason + "', strFrom: '" + from + "', strTo: '" + to + "', strChartNumber: '" + chartNumber + "' }";
$.ajax
({
type: "POST",
url: "AptSearchResult",
contentType: "application/json; charset=utf-8",
dataType: "json",
data: str,
success: function (data) {
$('#myTable').dataTable();
$('#myTable_filter').css('display', 'none');
if (data.length > 0) {
var row = ['<table id="myTable" class="table table-striped table-hover">\
<thead>\
<tr>\
<th><input type="checkbox" id="chkAll"></th>\
<th>Chart Number</th>\
<th>Reason To Visit</th>\
<th>Provider</th>\
<th>Location</th>\
<th>From</th>\
<th>To</th>\
</tr>\
</thead>\
<tbody>'].join('\n');
for (var i = 0; i < data.length; i++) {
var item = data[i];
row += ["<tr>\
<td><input type='checkbox' class='tblcheck' value='" + item.AppointmentId + "' id='chk_" + item.AppointmentId + "'></td>\
<td>" + item.ChartNumber + "</td>\
<td><a href='#' data-toggle='modal' >" + item.Description + "</a></td>\
<td>" + item.Provider + "</td>\
<td>" + item.Location + "</td>\
<td>" + item.StartDate + "</td>\
<td>" + item.EndDate + "</td>\
</tr>"];
}
row += ['</tbody>\
</table>'];
$("#gridContent").html(row);
$('#myTable').dataTable();
$('#myTable_filter').css('display', 'none');
}
else {
var row = ['<table id="myTable" class="table table-striped table-hover">\
<thead>\
<tr>\
<th><input type="checkbox" id="chkAll"></th>\
<th>Chart Number</th>\
<th>Reason To Visit</th>\
<th>Provider</th>\
<th>Location</th>\
<th>From</th>\
<th>To</th>\
</tr>\
</thead>\
<tbody>'].join('\n');
row += ["<tr class='odd'>\
<td valign='top' colspan='7' class='dataTables_empty' style='text-align:center'>No data available in table</td>\
</tr>"];
row += ['</tbody>\
</table>'];
$("#gridContent").html(row);
$('#myTable').dataTable();
$('#myTable_filter').css('display', 'none');
}
}
});
return false;
}
</script>
it show the warning message (DataTables warning: table id=myTable - Requested unknown parameter '1' for row 0. For more information about this error, please see http://datatables.net/tn/4).I have to remove this message.
推荐答案
.ajax
({
类型:POST,
url:AptSearchResult,
contentType:application / json; charset = utf-8,
dataType:json,
data :str,
success:function(data){
.ajax ({ type: "POST", url: "AptSearchResult", contentType: "application/json; charset=utf-8", dataType: "json", data: str, success: function (data) {
('#myTable')。dataTable();
('#myTable').dataTable();
('#myTable_filter')。css('display','none');
if(data.length> 0){
var row = ['< table id =myTableclass =table table-striped table-hover> \
< thead> \
< tr> \
< th><输入类型=复选框id =chkAll>< / th> \
< th>图表编号< / th> \
< th>原因参观< / th> ; \
< th>提供商< / th> \
< th>位置< / th> \
< th>来自< / th> \
< th>到< / th> \
< / tr> \
< / thead> \
< TBODY> ']加入(' \\\
');
for(var i = 0; i< data.length; i ++){
var item = data [i];
row + = [< tr> \
< td>< input type ='checkbox'class ='tblcheck'value ='+ item.AppointmentId +'id =' chk_+ item.AppointmentId +'>< / td> \
< td> + item.ChartNumber +< / td> \
< td>< a href ='#'data-toggle ='modal'> + item.Description +< / a>< / td> \
< td> + item.Provider +< / td> \
< td> + item.Location +< / td> \
< td> + item.StartDate +< / td> \
< td> + item.EndDate +< / td> \
< / tr>];
}
row + = ['< / tbody> \
< / table>'];
('#myTable_filter').css('display', 'none'); if (data.length > 0) { var row = ['<table id="myTable" class="table table-striped table-hover">\ <thead>\ <tr>\ <th><input type="checkbox" id="chkAll"></th>\ <th>Chart Number</th>\ <th>Reason To Visit</th>\ <th>Provider</th>\ <th>Location</th>\ <th>From</th>\ <th>To</th>\ </tr>\ </thead>\ <tbody>'].join('\n'); for (var i = 0; i < data.length; i++) { var item = data[i]; row += ["<tr>\ <td><input type='checkbox' class='tblcheck' value='" + item.AppointmentId + "' id='chk_" + item.AppointmentId + "'></td>\ <td>" + item.ChartNumber + "</td>\ <td><a href='#' data-toggle='modal' >" + item.Description + "</a></td>\ <td>" + item.Provider + "</td>\ <td>" + item.Location + "</td>\ <td>" + item.StartDate + "</td>\ <td>" + item.EndDate + "</td>\ </tr>"]; } row += ['</tbody>\ </table>'];
这篇关于我在datatable上得到了这条错误消息。请帮我解决这个问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文