<!DOCTYPE html>
<html>
<head>
<title></title>
<!-- Ignite UI for jQuery Required Combined CSS Files -->
<link href="http://cdn-na.infragistics.com/igniteui/2024.1/latest/css/themes/infragistics/infragistics.theme.css" rel="stylesheet" />
<link href="http://cdn-na.infragistics.com/igniteui/2024.1/latest/css/structure/infragistics.css" rel="stylesheet" />
<script src="http://ajax.aspnetcdn.com/ajax/modernizr/modernizr-2.8.3.js"></script>
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="http://code.jquery.com/ui/1.11.1/jquery-ui.min.js"></script>
<!-- Ignite UI for jQuery Required Combined JavaScript Files -->
<script src="http://cdn-na.infragistics.com/igniteui/2024.1/latest/js/infragistics.core.js"></script>
<script src="http://cdn-na.infragistics.com/igniteui/2024.1/latest/js/infragistics.lob.js"></script>
</head>
<body>
<p>Select precision and decimal places</p>
<div id="rating"></div>
<table>
<tr>
<td>Current value:</td>
<td>
<div id="currValue" style="width:70%"></div>
</td>
</tr>
<tr>
<td>Value as percent:</td>
<td>
<input id="chkPercent" type="checkbox" checked />
</td>
</tr>
<tr>
<td>Precision:</td>
<td>
<div class="comboContainer">
<select id="selectPrecision">
<option value="exact">Exact</option>
<option value="half">Half</option>
<option value="whole" selected="selected">Whole (default)</option>
</select>
</div>
</td>
</tr>
</table>
<script src="/TypeScriptSamples/rating/typescript.js"></script>
</body>
</html>
/// <reference path="/js/typings/jquery.d.ts" />
/// <reference path="/js/typings/jqueryui.d.ts" />
/// <reference path="/js/typings/igniteui.d.ts" />
$(function () {
$("#rating").igRating({
voteCount: 10,
valueAsPercent: true,
value: 0.4,
valueChange: function (evt, ui) {
$("#currValue").igTextEditor("value", ui.value);
}
});
$("#currValue").igTextEditor({
width: "100px",
value: 0.4
});
$("#selectPrecision").igCombo({
enableClearButton: false,
mode: "dropdown",
selectionChanged: function (evt, ui) {
if ($.isArray(ui.items) && ui.items[0] != undefined) {
$("#rating").igRating("option", "precision", ui.items[0].data.value);
}
}
});
$("#chkPercent").change(function () {
$("#rating").igRating("option", "valueAsPercent", $(this).is(":checked"));
$("#currValue").igTextEditor("value", $("#rating").igRating("value"));
});
});