Jquery IDisplayLength和iDisplayStart未发布到datatable的服务器端脚本
我在codeigniter 2.2项目中使用datatables,我必须添加一些新功能。json响应中没有返回任何数据。正在执行的查询是:Jquery IDisplayLength和iDisplayStart未发布到datatable的服务器端脚本,jquery,json,codeigniter,datatable,Jquery,Json,Codeigniter,Datatable,我在codeigniter 2.2项目中使用datatables,我必须添加一些新功能。json响应中没有返回任何数据。正在执行的查询是: SELECT SQL_CALC_FOUND_ROWS reference, narration, accountnumber, bank_name bank, amount FROM (`vb`) JOIN `bank_data` ON `bank_data`.`bank_code` =`vb`.`destinationcode` LIMIT 0 问题是
SELECT SQL_CALC_FOUND_ROWS reference, narration, accountnumber, bank_name bank, amount FROM (`vb`) JOIN `bank_data` ON `bank_data`.`bank_code` =`vb`.`destinationcode` LIMIT 0
问题是limit参数的值为0
以下代码段显示了获取分页所需的限制值的代码,因为我的大型数据集包含22000多条记录:
// Paging
if(isset($iDisplayStart) && $iDisplayLength != '-1')
{
$this->db->limit($this->db->escape_str($iDisplayLength), $this->db->escape_str($iDisplayStart));
}
$iDisplayStart和$iDisplayLength参数在此处获得
$iDisplayStart = $this->input->get_post('iDisplayStart', true);
$iDisplayLength =$this->input->get_post('iDisplayLength', true);
挑战在于这些值没有发布到服务器端脚本
我的答复是:
{sEcho: 0, iTotalRecords: 23048, iTotalDisplayRecords: 0, iDisplayLength: false, iDisplayStart: false,…}
综上所述,iDisplayLength和iDisplayStart都为false,因此导致select语句中的限制值为0
初始化数据表的html是
$('#datatable_tabletools').dataTable({
"bServerSide":true,
"bProcessing": false,
"sServerMethod": "POST",
"iDisplayLength": 25,
"iDisplayStart":0,
// Load data for the table's content from an Ajax source
"ajax":{'url':"<?php echo APP_URL.'/index.php/payments/getTable2';?>",
'type':'POST',},
"aoColumns": [
{ "data": "reference" },
{ "data": "narration" },
{ "data": "accountnumber" },
{ "data": "amount" },
{ "data": "bank_name" }
],
$iDisplayStart和$iDisplayLength参数已设置但未过帐,如何更正?谢谢如果您使用DataTables 1.10版,您使用的是弃用的stuffIIRC,如果您使用.dataTable方法而不是.dataTable,DataTables 1.10与旧API向后兼容请提供更详细的答案,并使用代码标签或外部代码编辑器共享示例。
{
render: function (data, type, row, meta)
return meta.row + meta.settings._iDisplayStart + 1;
}