【发布时间】:2015-02-12 10:36:47
【问题描述】:
目前在使用 Datable 时遇到错误。下面是我在视图文件中的代码。 错误/警告:DataTables 警告:表 id=example - 请求第 0 行的未知参数“census_health.memberid”
<table id="example" class="display" width="100%" cellspacing="0">
<thead>
<tr>
<th>Member Id</th>
<th>Name</th>
<th>Jss Card No</th>
<th>Bank Account No</th>
<th>Mamta Yojana Benefit</th>
<th>Home Visit</th>
<th>TT1</th>
<th>TT2</th>
<th>TT Status</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Member Id</th>
<th>Name</th>
<th>Jss Card No</th>
<th>Bank Account No</th>
<th>Mamta Yojana Benefit</th>
<th>Home Visit</th>
<th>TT1</th>
<th>TT2</th>
<th>TT Status</th>
</tr>
</tfoot>
</table>
数据表代码如下。
$(document).ready(function() {
var oTable = $('#example').dataTable({
"bProcessing": true,
"bServerSide": true,
"bRetrieve": true,
"bDestroy": true,
"sAjaxSource": "../../loadReportDataAjax/",
"aoColumns": [
{ mData: 'census_health.memberid' },
{ mData: 'hh_member.name' },
{ mData: 'census_health.jss_card_no' },
{ mData: 'census_health.bank_account_no' },
{ mData: 'census_health.mamta_yojana_benefit' },
{ mData: 'census_health.home_visit' },
{ mData: 'census_pregnant_anc_checkup.TT1' },
{ mData: 'census_pregnant_anc_checkup.TT2' },
{ mData: 'census_pregnant_anc_checkup.tt_status' }
],
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"iDisplayStart ":10,
'fnServerData': function (sSource, aoData, fnCallback) {
$.ajax
({
'dataType': 'json',
'type': 'POST',
'url': sSource,
'data': aoData,
'success': fnCallback
});
}
});
});
Json 响应如下。
{"sEcho":1,"iTotalRecords":"4","iTotalDisplayRecords":"4","aaData":[{"census_health.memberid":"26-391-1-20-104-59502-2","hh_member.name":"LATIKA NAIK","census_health.jss_card_no":"1111111111","census_health.bank_account_no":"2147483647","census_health.mamta_yojana_benefit":"Yes","census_health.home_visit":"EMPTY","census_pregnant_anc_checkup.TT1":"17-07-2013","census_pregnant_anc_checkup.TT2":"18-09-2013","census_pregnant_anc_checkup.tt_status":"Pending"},{"census_health.memberid":"26-391-1-20-104-59502-2","hh_member.name":"LATIKA NAIK","census_health.jss_card_no":"33333","census_health.bank_account_no":"363636","census_health.mamta_yojana_benefit":"Yes","census_health.home_visit":"ANM","census_pregnant_anc_checkup.TT1":"17-07-2013","census_pregnant_anc_checkup.TT2":"18-09-2013","census_pregnant_anc_checkup.tt_status":"Pending"},{"census_health.memberid":"26-391-1-20-104-59502-2","hh_member.name":"LATIKA NAIK","census_health.jss_card_no":"1111111111","census_health.bank_account_no":"2147483647","census_health.mamta_yojana_benefit":"Yes","census_health.home_visit":"EMPTY","census_pregnant_anc_checkup.TT1":"17-07-2013","census_pregnant_anc_checkup.TT2":"18-09-2013","census_pregnant_anc_checkup.tt_status":"Pending"},{"census_health.memberid":"26-391-1-20-104-59502-2","hh_member.name":"LATIKA NAIK","census_health.jss_card_no":"333331111","census_health.bank_account_no":"2147483647","census_health.mamta_yojana_benefit":"No","census_health.home_visit":"Anganwadi","census_pregnant_anc_checkup.TT1":"17-07-2013","census_pregnant_anc_checkup.TT2":"18-09-2013","census_pregnant_anc_checkup.tt_status":"Pending"}]}
【问题讨论】:
标签: datatable