如何在数据表标题之后放置数据表列过滤器

时间:2015-05-16 11:32:14

标签: codeigniter jquery-datatables jquery-datatables-editor

我想根据文本字段中的写入过滤第3列字段。但它不起作用。而且我还希望在表头之后对文本字段进行列过滤。

enter image description here

JS

<script type="text/javascript" src="assets/admin/js/jquery.validate.js"></script>
<script type="text/javascript" src="assets/admin/js/jquery.dataTables.js"></script>
<script type="text/javascript" src="assets/admin/js/jquery.datatables.columnfilter.js"></script>

JS

<script>
$(document).ready(function() {

$('#example').dataTable( {

"bProcessing": true,

"bFilter" : true,

//"bServerSide": true,

"aaSorting": [[0,'desc']],

"aoColumns":[{ "bVisible":false, "bSearchable": false, "bSortable": false},

{ "bVisible":true,"bSearchable": true, "bSortable": true , "mRender": rendercheckbox},

{ "bVisible":true,"bSearchable": true, "bSortable": true , "mRender": renderucwords},

{ "bVisible":true,"bSearchable": true, "bSortable": false , "mRender": renderattachment, "sClass": "center"},

{ "bVisible":true, "bSearchable": false, "bSortable": false ,"mRender": renderaction , "sClass": "center"}],

"bJQueryUI": true,

"sPaginationType": "full_numbers",

"sScrollX": "100%",

"sScrollXInner": "100%",

"bScrollCollapse": true,

"sAjaxSource":"<?php echo site_url('admins/promotion/getdata');?>"

} ).

columnFilter({

sPlaceHolder: "head:before",

bFilter: false,

aoColumns: [  null,

null,

{ type: "text",                         

},

null,

null

] 

});

});

</script>

2 个答案:

答案 0 :(得分:1)

使用

$('#example').DataTable( {});

而不是

$('#example').dataTable( {});

同时检查控制台中的任何javascript错误

答案 1 :(得分:0)

简单尝试一下

$('#example').DataTable( {});