have an external dropdown form which have a values of correct and incorrect, whenever incorrect is chosen a ajax post will run and will generate a span inside td for incorrect values. What I need is that datatables should filter out incorrect by checking span inside td.
HTML:
//Data Tables
<table id="data">
<thead>
<tr>Word</tr>
</thead>
<tbody>
<tr><td>Cat</td></tr>
<tr><td>Dog</td></tr>
<tr><td><span="wrong-spelling">Dogr<td></tr>
</tbody>
</table>
JS:
HTML:
<select id="filter"> <option value="correct">Correct</option> <option value="incorrect">Incorrect</option> </select>
//Data Tables
<table id="data">
<thead>
<tr>Word</tr>
</thead>
<tbody>
<tr><td>Cat</td></tr>
<tr><td>Dog</td></tr>
<tr><td><span="wrong-spelling">Dogr<td></tr>
</tbody>
</table>
JS:
$(document).ready(function(){ var dtTable = $('#data').dataTable( { "sDom": '<"H"lr>t<"F"ip>', "bSort": false, "bAutoWidth": false, "iDisplayStart": 0, "iDisplayLength": 25, "bProcessing": true, "sPaginationType": "full_numbers", "bJQueryUI": true, });
$("#filter").change(function(){ //Ajax Post request to check spelling }); });On #filter change, when incorrect is chosen it should only filter rows with span class wrong-spelling