I use Datatables for a review system. The user can rate each element by clicking on the stars (1 to 5).
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="tabela-disciplinas-preferencia"> <thead> <tr> <th>Semestre</th> <th>Curso</th> <th>Disciplina</th> <th>Nível de Interesse</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>Engenharia de Software</td> <td>Redes</td> <td> <div class="rating" valor="0"> <span valor="5">☆</span><span valor="4">☆</span><span valor="3">☆</span><span valor="2">☆</span><span valor="1">☆</span> </div> </td> </tr> .... </tbody> </table>
My js
$(document).ready(function() { $('#tabela-disciplinas-preferencia').dataTable( { "sPaginationType": "bootstrap" } ); });
However, when the user clicks to evaluate a single item, I change the valor attribute in the rating div, but datatables does not update its values internally.
Click Rating Event
$(document).ready(function() { $('div.rating span').click(function(){ starR= new StarRating( $(this).parent()); starR.changeValue($(this).attr('valor'));
How to update Datatables DOM? I already received the data and changed the value, but how can I return to oTable?
source share