Или вообще так...
app.ratingTooltipTpl = function (e) {
var res = "<div id='set-rating" + e.chainId + "'>";
for (var i = 0; i < 5; ++i) {
var cls='rating-'+(i<e.rating)? 'yellow-star': 'empty';
res+="<span rate=" + (i+1) + " chainId=" + e.chainId + " class='action-tooltip "+cls+"' onclick='setRating(this)'></span>";
};
res +="</div></br>Баллы:<span id='rating-rate" + e.chainId + "'>"+e.rating+"</span>";
return res;
};