下拉式筛选器jquery数据表

这是我的代码
$(document).ready(function() {
    /* Initialise the DataTable */
    var oTable = $('#example').dataTable({
        "oLanguage": {
            "sSearch": "Search all columns:"
        },"idisplayLength": 10,"bJQueryUI": true,"sPaginationType": "full_numbers","bFilter": true,}); 

    /* Add a select menu for each TH element in the table footer */
    $("thead th").each( function ( i ) {
        this.innerHTML = fnCreateSelect( oTable.fnGetColumnData(i) );
        $('select',this).change( function () {
            oTable.fnFilter( $(this).val(),i );
        } );
    } );        
} );

我使用jquery datatables插件,它的工作完全就像这个例子:

http://www.datatables.net/release-datatables/examples/api/multi_filter_select.html

我想做的是,而不是为每个列下拉列表,我只想在一个特定的列上下拉列表.

所以我想我需要改变:

$("thead th").each( function ( i ) {

但我不知道该放什么.任何帮助将不胜感激,谢谢提前.

解决方法

如果你只需要一列,你可以做
var indexOfMyCol = 2;//you want it on the third column
$("thead th").each( function ( i ) {
    if(i === indexOfMyCol){ 
      this.innerHTML = fnCreateSelect( oTable.fnGetColumnData(i) );
      $('select',this).change( function () {
        oTable.fnFilter( $(this).val(),i );
      } );
    }
} );

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: <span id=&quot...
jQuery 添加水印 <script src="../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...