我刚刚添加DataTables列过滤器附加到我的数据表,它显示页脚上的列搜索字段。但是,如果我输入“处理”是短时间完成的,但结果不会更新。即过滤。DataTables列过滤器附加显示,但输出未过滤
我在后端使用codeIgniters ignitedDatatables。其他一切正常(分页,右上角的全局搜索) 我发现网络上没有线索,无论我是否需要配置其他内容以使过滤器正常工作。
这里是我的视图 -
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://localhost/eshop/css/admin/style.css" />
<script type="text/javascript" language="javascript" src="<?php echo base_url() ?>js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" language="javascript" src="<?php echo base_url() ?>js/jquery.dataTables.min.js"></script>
<script type="text/javascript" language="javascript" src="<?php echo base_url() ?>js/jquery.dataTables.columnFilter.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo base_url() ?>css/jquery.dataTables_themeroller.css"/>
<link rel="stylesheet" href="http://localhost/eshop/css/admin/smoothness/jquery-ui-custom.css"/>
<script>
$(document).ready(function() {
$('#data_table').dataTable({
"bProcessing": true,
"bServerSide": true,
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"sAjaxSource": "<?php echo base_url() ?>grid/getCustomers"
}).columnFilter(
{
aoColumns: [
{
type: "number"
},
{
type: "text",
bRegex: true,
bSmart: true
},
null
]
}
);
});
</script>
</head>
<body>
<div class="widget_body">
<table id="data_table" class="data_table">
<thead>
<tr>
<th>ID</th>
<th>First Name</th>
<th>Last Name</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
<tfoot style="background-color: whitesmoke;">
<tr>
<th></th>
<th></th>
<th></th>
</tr>
</tfoot>
</table>
</div>
</body>
我的控制
//display
public function index()
{
$this->load->view('datatableview');
}
//ajax request handler
public function getCustomers()
{
$this->load->library('datatables');
$this->datatables->select('id,first_name,last_name')
->from('data_table');
echo $this->datatables->generate();
}
正如我前面所说的2个输入框出现在标识和名字的底部,但我看不到变化显示一旦我键入框
如果我键入=“Bjo”在第二列的输入b张不开从萤火GET请求,我发现是
_=1354249241305
bRegex=false
bRegex_0=false
bRegex_1=true
bRegex_2=false
bSearchable_0=true
bSearchable_1=true
bSearchable_2=true
bSortable_0=true
bSortable_1=true
bSortable_2=true
iColumns=3
iDisplayLength=10
iDisplayStart=0
iSortCol_0=0
iSortingCols=1
mDataProp_0=0
mDataProp_1=1
mDataProp_2=2
sColumns=
sEcho=22
sRangeSeparator=~
sSearch=
sSearch_0=
sSearch_1=Bjo
sSearch_2=
sSortDir_0=asc
的响应被发现
{"sEcho":22,"iTotalRecords":30,"iTotalDisplayRecords":30,"aaData":[["1","Shabab","Haider"],["2","Anas","Numan"],["3","Bjoy","Manik"],["4","Bjoy","Manik"],["5","Bjoy","Manik"],["6","Bjoy","Manik"],["7","Bjoy","Manik"],["8","Bjoy","Manik"],["9","Bjoy","Manik"],["10","Bjoy","Manik"]],"sColumns":"id,first_name,last_name"}
编辑:它已经有一段时间,因为我用的是添加上。我在github中用我的过滤代码创建了一个分支。但它需要一些测试。我想测试一下自己,当我得到的时间。同时,如果有人想成为一个亲爱的,做它取诚待人
https://github.com/shababhsiddique/Ignited-Datatables/blob/Branche_Column_Filter/application/libraries/Datatables.php
这是我很久以前实际使用的代码。它的老检查,如果它适用于您的版本
https://drive.google.com/file/d/0BzKzAVzAWPRgcmNCbGhnU3pqaW8/view?usp=sharing
您是否检查过请求的开发工具/萤火虫?这可能会发回500或db错误。 – stormdrain
我可以给你什么信息?请告诉我。我以前没有使用这种类型的工具。无论如何,我已经更新了萤火虫获取请求的问题 – shababhsiddique
https://developers.google.com/chrome-developer-tools/docs/network – stormdrain