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 }.
<table class="data-table">
<thead>
<tr>
<th>Text</th>
<th>Text</th>
<th>Text</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>Lorem</td>
<td>Ipsum</td>
<td>Dolor</td>
<td>$1.99</td>
</tr>
<tr>
<td>Lorem</td>
<td>Ipsum</td>
<td>Dolor</td>
<td>$2.99</td>
</tr>
<tr>
<td>Lorem</td>
<td>Ipsum</td>
<td>Dolor</td>
<td>$-1.99</td>
<tr>
<td>Lorem</td>
<td>Ipsum</td>
<td>Dolor</td>
<td>$-2.99</td>
</tr>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="4">
<select class="select-filter">
<option value="1">All</option>
<option value="2">Positive</option>
<option value="3">Negative</option>
</select>
</tr>
</tfoot>
</table>
Then I've tried a couple of js:
$(function(){
$(".data-table").dataTable();
$('.select-filter').change(function(){oTable.fnDraw();});
});
But the one that "looks" easiest to make do what I want is:
$(".data-table").dataTable().columnFilter({
aoColumns: [
null,
null,
null,
{type: "select"}
]
});
Although, that one will just create a select that contains all the values. How can I accomplish this?