Using a dropdown list to filter a table (dataTables)

前端 未结 3 1693
被撕碎了的回忆
被撕碎了的回忆 2021-02-14 23:30

I\'m using the dataTables jQuery plugin (which is totally awesome), but I\'m having trouble getting my table to filter based on the change of my select box.

Function:

3条回答
  •  花落未央
    2021-02-15 00:23

    Use this code:

     $('.btn-success').on('click',function (e) {
                   //to prevent the form from submitting use e.preventDefault()
                    e.preventDefault();
                    var res = $("#userid").val();  
                    var  sNewSource = "myaccount/MyData_select?userid=" + res + "";
                    var oSettings = ETable.fnSettings();
                    oSettings.sAjaxSource  = sNewSource;
                    ETable.fnDraw();
                });
    

提交回复
热议问题