我已使用此代码为每个字段生成搜索框。但它在 .columnFilter行显示语法错误({。如何解决此问题
<script type="text/javascript" charset="utf-8">
//initialisation code
$(document).ready(function() {
$('#example').dataTable( {
"sPaginationType": "full_numbers",
.columnFilter({
sPlaceHolder: "head:before",
aoColumns: [ {
type: "select",
values: [ 'Gecko', 'Trident', 'KHTML',
'Misc', 'Presto', 'Webkit', 'Tasman']
},
{ type: "text" },
{ type: "number" },
{ type: "date-range" },
{ type: "number-range" }
]
} );
} );
</script>
答案 0 :(得分:0)
看起来像是一个javascript语法问题。尝试改为:
$(document).ready(function() {
$('#example').dataTable( {
"sPaginationType": "full_numbers"
})
.columnFilter({
sPlaceHolder: "head:before",
aoColumns: [ {
type: "select",
values: [ 'Gecko', 'Trident', 'KHTML',
'Misc', 'Presto', 'Webkit', 'Tasman']
},
{ type: "text" },
{ type: "number" },
{ type: "date-range" },
{ type: "number-range" }
]
} );
} );
答案 1 :(得分:0)
$(document).ready(function(){
$('#example').dataTable().columnFilter();
}
)
使您可以在.columnFilter之前关闭dataTable()括号。
希望它有效。