Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery DataTables filter column with comparison operators
    primarykey
    data
    text
    <p>I've been using the DataTables jQuery plugin with the filter plug in, and it is awesome. However, I was wondering if it is possible to filter table columns by row using a comparison operator (e.g. <code>'&lt;' '&gt;' or '&lt;&gt;'</code>) before a value in the filter input at the bottom of the table.</p> <p><a href="http://www.datatables.net/plug-ins/filtering#functions" rel="noreferrer">http://www.datatables.net/plug-ins/filtering#functions</a></p> <p>There is way to filter by range using input fields that accept a max and min value. However, I'd like to forgo adding two additional input fields and somehow parse the input of this column.</p> <p>The row i want to filter is populated with only integers (age) values.</p> <p>some examples of desire behaviour:</p> <pre><code>input results &lt; 20 less than than 20 &gt; 20 greater than 20 20 - 80 between 20 and 80 &lt;&gt; 20 not 20 </code></pre> <p>Anyone have experience modifying the behavior of the filter plugin to achieve this behavior? Thanks.</p> <p><strong>edit:</strong></p> <p><img src="https://i.stack.imgur.com/bRmyH.png" alt="example image"></p> <p>I'd like to be able to directly type in the comparison operator into these input boxes. If an operator is detected it will filter based on the operator. If no filter operator is detected, I'd like it to filter normally.</p> <p>the html for the filter input looks like this:</p> <pre><code>&lt;tfoot&gt; &lt;tr&gt; ... &lt;th class=" ui-state-default"&gt; &lt;input type="text" class="search_init" value="Age" name="search_age"&gt; &lt;/th&gt; &lt;th class=" ui-state-default"&gt; &lt;input type="text" class="search_init" value="PD Status" name="search_age_of_onset"&gt; &lt;/th&gt; ... &lt;/tr&gt; &lt;/tfoot&gt; </code></pre> <p>Thanks!</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.
 

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