lundi 27 juin 2016

sort checked checkbox on datatables

I have a table using datatables. It contains a checkbox on first column. How can I sort the table so when a checkbox is checked, the checked row should go on top?

<table class="table table-bordered table-striped">
  <thead align='center'><tr><th></th><th>Alphabet</th><th>Numeric</th></tr></thead>
  <tbody align='center'>
    <tr>
      <td><input type='checkbox' name='id[]' value=1></td>
      <td>A</td>
      <td>10</td>
    </tr>
    <tr>
      <td><input type='checkbox' name='id[]' value=2></td>
      <td>B</td>
      <td>100</td>
    </tr>
    <tr>
      <td><input type='checkbox' name='id[]' value=3></td>
      <td>C</td>
      <td>1000</td>
    </tr>
  </tbody>
</table>




Aucun commentaire:

Enregistrer un commentaire