Pregunta

I'm more than a bit rusty and I'm having trouble applying the jQuery "star rating" transformation found here to data retrieved via MySQL for jTable.

I feel as though I should be using the event handler recordsLoaded but I cannot find any documentation on how to implement it. Likewise, I think I should be doing a callback or jQuery's $.when() to validate the data exists, but every attempt I've made has only resulted in catastrophic failure.

Seeking a rudimentary example on how to apply jQuery/JS functions on data returned through jTable. All assistance welcome.

For example, why wouldn't this work, or what am I messing up with the syntax?

$.when(
  $('#data').jtable('load'),
).then(function() {
  $('td.stars').stars();
});
¿Fue útil?

Solución

The trick was:

        recordsLoaded: function(event, data) {
          $('td.stars').stars();
        }
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top