I have cracked the issue of mine.
Big thanks to @ChetanGoti who left the sample code in issue #91 and #99 which gave me some ideas to manipulate the script to suit my purpose.
I had to wrap ChetanGoti's code in a function to stop it iterate within its won record because the star rating is built on the
, so that the'data-current-rating' would apply to each record and no loop from .each().
I use initialRating to display the overall star rate for each record, from which is built within a
$(function () { $(".idRate").barrating({ theme: 'fontawesome-stars-o', allowEmpty: true, initialRating: **2.0**, readonly: true }) // $(".idRate").barrating('clear'); //$(".idRate").barrating('destroy'); $(".idRate").barrating('set',0); });
or$(function () { $(".idRate").barrating({ theme: 'fontawesome-stars-o', allowEmpty: true, initialRating: **1.6**, readonly: true }) // $(".idRate").barrating('clear'); //$(".idRate").barrating('destroy'); $(".idRate").barrating('set',0); });
I have tried to add 'clear', 'set value' and 'destroy' but none worked. Anyone knows why it renders ok but not showing the correct star rating please?
I have cracked the issue of mine. Big thanks to @ChetanGoti who left the sample code in issue #91 and #99 which gave me some ideas to manipulate the script to suit my purpose. I had to wrap ChetanGoti's code in a function to stop it iterate within its won record because the star rating is built on the
`$(function () { $('.idRate').each(function (Index, el) { var $El = $(el); $El.barrating({ theme: 'fontawesome-stars-o', allowEmpty: true, initialRating: $El.attr('data-current-rating'), readonly: true })