Customizing the Ratings

You can control the number of ratings that are displayed and the tooltip displayed for each rating by setting the maxRating and tooltipStrings properties. For example, the following Rating control only displays three stars and the stars have the tooltips bad, okay, and great! (see Figure 4.11).

<div id="ratingProduct"    data-win-control="WinJS.UI.Rating"    data-win-options="{        averageRating:2,        maxRating:3,        tooltipStrings: ['bad', 'okay', 'great!']    }"></div>

Image

FIGURE 4.11 Customizing Rating control ratings

Notice that the tooltipStrings property accepts a JavaScript array. ...

Get Windows® 8.1 Apps with HTML5 and JavaScript Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.