Note that there are some explanatory texts on larger screens.

plurals
  1. POFilter jQuery dataTables on negative integer
    primarykey
    data
    text
    <p>I can sort a dataTable on negatives just fine, but I wanted to filter instead of sort on a select.change() event. Basically, I just need it to take the value of column 4 and render the row based on the select box selection { all, positive, or negative }.</p> <pre><code>&lt;table class="data-table"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Text&lt;/th&gt; &lt;th&gt;Text&lt;/th&gt; &lt;th&gt;Text&lt;/th&gt; &lt;th&gt;Value&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;Lorem&lt;/td&gt; &lt;td&gt;Ipsum&lt;/td&gt; &lt;td&gt;Dolor&lt;/td&gt; &lt;td&gt;$1.99&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Lorem&lt;/td&gt; &lt;td&gt;Ipsum&lt;/td&gt; &lt;td&gt;Dolor&lt;/td&gt; &lt;td&gt;$2.99&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Lorem&lt;/td&gt; &lt;td&gt;Ipsum&lt;/td&gt; &lt;td&gt;Dolor&lt;/td&gt; &lt;td&gt;$-1.99&lt;/td&gt; &lt;tr&gt; &lt;td&gt;Lorem&lt;/td&gt; &lt;td&gt;Ipsum&lt;/td&gt; &lt;td&gt;Dolor&lt;/td&gt; &lt;td&gt;$-2.99&lt;/td&gt; &lt;/tr&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;tfoot&gt; &lt;tr&gt; &lt;td colspan="4"&gt; &lt;select class="select-filter"&gt; &lt;option value="1"&gt;All&lt;/option&gt; &lt;option value="2"&gt;Positive&lt;/option&gt; &lt;option value="3"&gt;Negative&lt;/option&gt; &lt;/select&gt; &lt;/tr&gt; &lt;/tfoot&gt; &lt;/table&gt; </code></pre> <p>Then I've tried a couple of js:</p> <pre><code>$(function(){ $(".data-table").dataTable(); $('.select-filter').change(function(){oTable.fnDraw();}); }); </code></pre> <p>But the one that "looks" easiest to make do what I want is:</p> <pre><code>$(".data-table").dataTable().columnFilter({ aoColumns: [ null, null, null, {type: "select"} ] }); </code></pre> <p>Although, that one will just create a select that contains all the values. How can I accomplish this?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload