Filter two value from two column in Datatable without use of search.

Filter two value from two column in Datatable without use of search.

spiderkznspiderkzn Posts: 44Questions: 12Answers: 0

Hi,

I need your help with filter the datatables without use the search. So based I have two dropdown which it will used in filter in column 6 and 7 in seperate way.

What I've use the code below:

var tableSummary= $("#summary-report-table").DataTable();

var Name_Filter = $("#ddName option:selected").text();
var Year_Filter = $("#ddYear option:selected").text();

So I need a filter for Name_Filter on column 6 and Year_Filter on column 7.

I look forward to hearing your response.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓
    tableSummary.column(6).search(Name_Filter);
    tableSummary.column(7).search(Year_Filter);
    tableSummary.draw();
    

    should do it. That uses the column().search() method.

    Allan

  • spiderkznspiderkzn Posts: 44Questions: 12Answers: 0

    Working. Thank Alan

Sign In or Register to comment.