mirror of
https://github.com/hanzoai/jube-fork.git
synced 2026-11-02 14:29:36 +00:00
233 lines
10 KiB
HTML
Executable File
233 lines
10 KiB
HTML
Executable File
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>HTML element binding</title>
|
|
<meta charset="utf-8">
|
|
<link href="../content/shared/styles/examples-offline.css" rel="stylesheet">
|
|
<link href="../../styles/kendo.common.min.css" rel="stylesheet">
|
|
<link href="../../styles/kendo.rtl.min.css" rel="stylesheet">
|
|
<link href="../../styles/kendo.default.min.css" rel="stylesheet">
|
|
<link href="../../styles/kendo.default.mobile.min.css" rel="stylesheet">
|
|
<script src="../../js/jquery.min.js"></script>
|
|
<script src="../../js/jszip.min.js"></script>
|
|
<script src="../../js/kendo.all.min.js"></script>
|
|
<script src="../content/shared/js/console.js"></script>
|
|
<script>
|
|
|
|
</script>
|
|
|
|
|
|
</head>
|
|
<body>
|
|
|
|
<a class="offline-button" href="../index.html">Back</a>
|
|
|
|
<div id="example">
|
|
<div class="demo-section k-content wide">
|
|
<div>
|
|
<ul class="fieldlist">
|
|
<li><h4>Text</h4> <input type="text" data-bind="value: textValue" class="k-textbox" /></li>
|
|
<li><h4>Text with update on keyup event</h4> <input type="text" data-value-update="keyup" data-bind="value: textValue" class="k-textbox" /></li>
|
|
<li><h4>Textarea</h4> <textarea data-bind="value: textareaValue" class="k-textbox" style="height: 40px; width: 140px;"></textarea></li>
|
|
<li><h4>Checkbox</h4>
|
|
<label>
|
|
<input type="checkbox" data-bind="checked: checkboxValue" />Check
|
|
</label>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div>
|
|
<ul class="fieldlist">
|
|
<li><h4>Radio</h4>
|
|
<label>
|
|
<input type="radio" name="fruit" value="Apple"
|
|
data-bind="checked: radioValue" />Apple
|
|
</label>
|
|
<label>
|
|
<input type="radio" name="fruit" value="Banana"
|
|
data-bind="checked: radioValue" />Banana
|
|
</label>
|
|
<label>
|
|
<input type="radio" name="fruit" value="Orange"
|
|
data-bind="checked: radioValue" />Orange
|
|
</label>
|
|
</li>
|
|
<li><h4>Checkbox list</h4>
|
|
<label>
|
|
<input type="checkbox" value="Apple"
|
|
data-bind="checked: checkboxListValue" />Apple
|
|
</label>
|
|
<label>
|
|
<input type="checkbox" value="Banana"
|
|
data-bind="checked: checkboxListValue" />Banana
|
|
</label>
|
|
<label>
|
|
<input type="checkbox" value="Orange"
|
|
data-bind="checked: checkboxListValue" />Orange
|
|
</label>
|
|
</li>
|
|
<li><h4>Select</h4> <select data-bind="source: fruits, value: selectValue" style="width: 147px;"></select></li>
|
|
<li><h4>Multiple select</h4> <select multiple data-bind="source: fruits, value: multipleSelectValue" style="width: 147px;"></select></li>
|
|
</ul>
|
|
</div>
|
|
<div>
|
|
<h4>Current view model state</h4>
|
|
<pre class="prettyprint">
|
|
{
|
|
textValue: <span data-bind="text: textValue"></span>,
|
|
textareaValue: <span data-bind="text: textareaValue"></span>,
|
|
checkboxValue: <span data-bind="text: checkboxValue"></span>,
|
|
radioValue: <span data-bind="text: radioValue"></span>,
|
|
checkBoxListValue: [<span data-bind="text: displayCheckBoxListValue"></span>],
|
|
selectValue: <span data-bind="text: selectValue"></span>,
|
|
multipleSelectValue: [<span data-bind="text: displayMultipleSelectValue"></span>]
|
|
}
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
$(document).ready(function() {
|
|
var viewModel = kendo.observable({
|
|
textValue: "Text value",
|
|
textareaValue: "Textarea value",
|
|
checkboxValue: false,
|
|
radioValue: "Apple",
|
|
checkboxListValue: ["Apple"],
|
|
multipleSelectValue: ["Apple"],
|
|
fruits:["Apple", "Banana", "Orange"],
|
|
selectValue: "Apple",
|
|
displayCheckBoxListValue: function() {
|
|
return this.get("checkboxListValue").join(", ");
|
|
},
|
|
displayMultipleSelectValue: function() {
|
|
return this.get("multipleSelectValue").join(", ");
|
|
}
|
|
});
|
|
|
|
kendo.bind($("div.demo-section"), viewModel);
|
|
});
|
|
</script>
|
|
<div class="box wide">
|
|
<h4>View source code:</h4>
|
|
<div class="code-details">
|
|
<pre class="prettyprint">
|
|
<div class="demo-section k-content wide">
|
|
<div>
|
|
<ul class="fieldlist">
|
|
<li><h4>Text</h4> <input type="text" data-bind="value: textValue" class="k-textbox" /></li>
|
|
<li><h4>Text with update on keyup event</h4> <input type="text" data-value-update="keyup" data-bind="value: textValue" class="k-textbox" /></li>
|
|
<li><h4>Textarea</h4> <textarea data-bind="value: textareaValue" class="k-textbox" style="height: 40px; width: 140px;"></textarea></li>
|
|
<li><h4>Checkbox</h4>
|
|
<label>
|
|
<input type="checkbox" data-bind="checked: checkboxValue" />Check
|
|
</label>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div>
|
|
<ul class="fieldlist">
|
|
<li><h4>Radio</h4>
|
|
<label>
|
|
<input type="radio" name="fruit" value="Apple"
|
|
data-bind="checked: radioValue" />Apple
|
|
</label>
|
|
<label>
|
|
<input type="radio" name="fruit" value="Banana"
|
|
data-bind="checked: radioValue" />Banana
|
|
</label>
|
|
<label>
|
|
<input type="radio" name="fruit" value="Orange"
|
|
data-bind="checked: radioValue" />Orange
|
|
</label>
|
|
</li>
|
|
<li><h4>Checkbox list</h4>
|
|
<label>
|
|
<input type="checkbox" value="Apple"
|
|
data-bind="checked: checkboxListValue" />Apple
|
|
</label>
|
|
<label>
|
|
<input type="checkbox" value="Banana"
|
|
data-bind="checked: checkboxListValue" />Banana
|
|
</label>
|
|
<label>
|
|
<input type="checkbox" value="Orange"
|
|
data-bind="checked: checkboxListValue" />Orange
|
|
</label>
|
|
</li>
|
|
<li><h4>Select</h4> <select data-bind="source: fruits, value: selectValue" style="width: 147px;"></select></li>
|
|
<li><h4>Multiple select</h4> <select multiple data-bind="source: fruits, value: multipleSelectValue" style="width: 147px;"></select></li>
|
|
</ul>
|
|
</div>
|
|
<div>
|
|
<h4>Current view model state</h4>
|
|
<pre>
|
|
{
|
|
textValue: <span data-bind="text: textValue"></span>,
|
|
textareaValue: <span data-bind="text: textareaValue"></span>,
|
|
checkboxValue: <span data-bind="text: checkboxValue"></span>,
|
|
radioValue: <span data-bind="text: radioValue"></span>,
|
|
checkBoxListValue: [<span data-bind="text: displayCheckBoxListValue"></span>],
|
|
selectValue: <span data-bind="text: selectValue"></span>,
|
|
multipleSelectValue: [<span data-bind="text: displayMultipleSelectValue"></span>]
|
|
}
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</pre>
|
|
</div>
|
|
|
|
<h4 style="padding-top: 2em;">View model source code:</h4>
|
|
<div class="code-details">
|
|
<pre class="prettyprint">
|
|
var viewModel = kendo.observable({
|
|
textValue: "Text value",
|
|
textareaValue: "Textarea value",
|
|
checkboxValue: false,
|
|
radioValue: "Apple",
|
|
checkboxListValue: ["Apple"],
|
|
multipleSelectValue: ["Apple"],
|
|
fruits:["Apple", "Banana", "Orange"],
|
|
selectValue: "Apple",
|
|
displayCheckBoxListValue: function() {
|
|
return this.get("checkboxListValue").join(", ");
|
|
},
|
|
displayMultipleSelectValue: function() {
|
|
return this.get("multipleSelectValue").join(", ");
|
|
}
|
|
});
|
|
|
|
kendo.bind($("div.demo-section"), viewModel);
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
<style>
|
|
.demo-section > div {
|
|
float: left;
|
|
margin-bottom: 2em;
|
|
}
|
|
.fieldlist {
|
|
margin: 0 3em 0 0;
|
|
padding: 0;
|
|
}
|
|
|
|
.fieldlist li {
|
|
list-style: none;
|
|
padding-bottom: 1.5em;
|
|
text-align: left;
|
|
}
|
|
|
|
.prettyprint {
|
|
background-color: #fff;
|
|
border: 1px solid #ccc;
|
|
overflow: auto;
|
|
padding: 5px;
|
|
}
|
|
</style>
|
|
</div>
|
|
|
|
|
|
|
|
</body>
|
|
</html>
|