Jquery数据表动态过滤

时间:2014-05-08 06:55:50

标签: jquery jquery-plugins

我的数据表中的标题内容和列数将不同。所以我无法静态声明thead或tfoot。 有没有办法动态引入tfoot? Currenlty我正在插入标题如下。

我想在数据表的每一列上实现过滤.Tried columnfilter但它需要静态声明tfoot(非动态)

var columns=[
        { "sTitle": "Customer ID","mData": "customerId", "sWidth": "15%" },
        { "sTitle": "ID","mData": "Id", "sWidth": "10%"  },
        { "sTitle": "Customer Name","mData": "primaryName", "sWidth": "15%"          },
        { "sTitle": "Email","mData": "primaryEmail", "sWidth": "20%"  },
        { "sTitle": "Contact Number","mData": "phoneNumber", "sWidth": "20%"  },
        { "sTitle": "Last Updateds","mData": "lastUpdated" , "sWidth": "20%"  }
    ];

var oTable = $('#table_panel2').dataTable( {
  "sDom": 'ipl<"dt_actions">tip"',
  "oLanguage": {
    "sLengthMenu": "_MENU_",
    "sInfo": "_START_-_END_ of _TOTAL_ ",
    "oPaginate": {
      "sNext": '',
      "sLast": '',
      "sFirst": '',
      "sPrevious": '' }
  },
  "bAutoWidth": false, 
  "sPaginationType": "full_numbers",
  "iDisplayLength": 15,
  "aLengthMenu": [[15, 30, 50, 100, -1], ["Show: 15 Results","Show: 30 Results","Show: 50 Results","Show: 100 Results", "Show All Results"]],
  "sAjaxSource" : 'simpleSearch.html?searchString='+p,
  "aoColumns": columns
});

0 个答案:

没有答案