我如何检索数据行,取决于头部选择的值使用jquery

How can I retrieve datatable rows, depending upon thead selected value using jquery?

本文关键字:选择 头部 取决于 jquery 何检索 检索 数据      更新时间:2023-09-26

我使用jQuery数据表。我在一列中使用动态下拉列表。这里我在thead中选取了一个下拉列表。现在,如果我从thead中选择值,那么数据表。

行应该从下拉菜单中选择的相同值中检索。

示例代码:

$(document).ready(function() {
    /* Initialise the DataTable */
    var oTable = $('#dt3').dataTable( {
        "oLanguage": {
            "sSearch": "Search all columns:"
        }
    } );
    /* Add a select menu for each TH element in the table footer */
    $("#status").each( function ( i ) {  // status is a id of thead dropdown
        this.innerHTML = fnCreateSelect( oTable.fnGetColumnData(i) );
        $('select', this).change( function () {

        var sel= $(this).val(); 
        alert(sel);
  $(".statusselect option:selected").each(function() {
    var selectedvalue=$(this).text();
    if(sel==selectedvalue)
    alert($(this).text());
    oTable.fnFilter( $(this).val(), i );
});
     //oTable.fnFilter( $(this).val(), i );
        } );
    } );
} );

在这里,我只能看到那些从datatable中打开的分页相同的选择值。但是我如何显示所有值从datatable使用:

oTable.fnFilter( $(this).val(), i );  //$(this).val(), i 

但是我没有得到我必须在这里提到的来解决我的问题。

尝试关闭分页,以便加载所有结果。