90 строки
3.0 KiB
HTML
90 строки
3.0 KiB
HTML
<!doctype html>
|
|
|
|
<html>
|
|
<head>
|
|
<title>Essential JS 1: Rating - KnockOut</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" charset="utf-8" />
|
|
<link href="../content/bootstrap.min.css" rel="stylesheet">
|
|
<link href="../content/ejthemes/default-theme/ej.web.all.min.css" rel="stylesheet" />
|
|
<link href="../content/default.css" rel="stylesheet" />
|
|
<link href="../content/default-responsive.css" rel="stylesheet" />
|
|
<!--[if lt IE 9]>
|
|
<script src="../scripts/jquery-1.11.3.min.js" type="text/javascript" ></script>
|
|
<![endif]-->
|
|
<!--[if IE 9]><!-->
|
|
<script src="../scripts/jquery-3.4.1.min.js" type="text/javascript"> </script>
|
|
<!--<![endif]-->
|
|
<script src="../scripts/ej.web.all.min.js" type="text/javascript"></script>
|
|
<script src="../scripts/properties.js" type="text/javascript"></script>
|
|
<script src="../scripts/knockout.min.js" type="text/javascript"></script>
|
|
<script src="../scripts/ej.widget.ko.min.js" type="text/javascript"></script>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="content-container-fluid">
|
|
<div class="row">
|
|
<div class="cols-sample-area">
|
|
<div class="frame">
|
|
<div class="knockbind">
|
|
<div id="control">
|
|
<input id="apiRating" type="text" class="rating" data-bind="ejRating: { value:ratingValue,width:'161px',precision:'exact'}">
|
|
</div>
|
|
<div id="binding">
|
|
<input type="text" name="rating" class="input ejinputtext" data-bind="ejNumericTextbox: { value:ratingValue,decimalPlaces:1,showSpinButton:false,width:'150px',incrementStep:0.1, minValue:0,maxValue:5 }" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
var raingObj;
|
|
$(function () {
|
|
// declaration
|
|
raingObj = $("#apiRating").data("ejRating");
|
|
$("#btnGetValue").ejButton({ "click": "onGetValueClck", "width": "100px" });
|
|
});
|
|
window.viewModel = {
|
|
ratingValue: ko.observable(3),
|
|
};
|
|
|
|
$(function () {
|
|
ko.applyBindings(viewModel);
|
|
raingObj = $("#apiRating").data("ejRating");
|
|
});
|
|
function onGetValueClck(args) {
|
|
var val = raingObj.getValue();
|
|
alert("Current Value : " + val);
|
|
}
|
|
|
|
function onResetClck() {
|
|
raingObj.reset();
|
|
}
|
|
function onShowHideRating(args) {
|
|
if (args.isChecked)
|
|
raingObj.hide();
|
|
else
|
|
raingObj.show();
|
|
}
|
|
function onShowHideReset(args) {
|
|
if (args.isChecked)
|
|
raingObj.option({ allowReset: false });
|
|
else
|
|
raingObj.option({ allowReset: true });
|
|
}
|
|
|
|
</script>
|
|
<style>
|
|
.knockbind > div {
|
|
padding:5px;
|
|
}
|
|
.e-rating.e-widget.e-horizontal {
|
|
margin: auto;
|
|
}
|
|
</style>
|
|
</body>
|
|
<script type="text/javascript">
|
|
$("#sampleProperties").ejPropertiesPanel();
|
|
</script>
|
|
</html>
|