我正在codeigniter项目中使用bootstrap datatables,我在页脚中包含了datatables js,并像这样初始化:
$('.datatable').dataTable({
"sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span12'i><'span12 center'p>>",
"sPaginationType": "bootstrap",
"oLanguage": {
"sLengthMenu": "_MENU_ records per page"
}
} );
现在我想在所需列的所需列表页面中使用自定义过滤器,我尝试了以下方法:
<select id="s" name="s">
<option value="1">Hyd</option>
<option value="2">Warangal</option>
</select>
并使用js
<script>
$(document).ready(function(){
$('#s').change( function() {
//alert($(this).val());
oTable.fnFilter( $(this).val(), 2 );
} );
});
</script>
我想使用下拉列表来筛选城市。