Holt59 / datatable

Javascript Plugin for data tables creation
http://holt59.github.io/datatable/
MIT License
107 stars 42 forks source link

No idea how to make filter outside table #35

Open AkshayChan opened 6 years ago

AkshayChan commented 6 years ago

Hello,

I have no clue about how to use my filter outside the table. I have created a select element

  <select id="ASIN" class= "custom-select">
    <!--
    <option>ASIN</option>
    <option>B0000934FH</option>
    <option>B00009ABCD</option>
    <option>B00009HYTD</option>
    -->
  </select>

This is what I'm trying to do

filters: { _1 : { element : $("#ASIN"), values : {0: "B0000934FH", 1: "B00009HYTD"} },

I don't have an id for the column and ASIN is the id for my select element.

Please help

Thanks

Holt59 commented 6 years ago

I can't really help you if I don't know what your data looks like. If you don't have an id for the column, you likely have a column number (e.g., you want to filter the second column).

Also, the filtering is done on the key of the values object, so you should rather do something like:

filters: [
    2: { element: $("#ASIN"), values: { B0000934FH: "B0000934FH", ... }
}