-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathdemo.html
49 lines (43 loc) · 2.06 KB
/
demo.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8" />
<title>Combobox demo</title>
<script src="http://knockoutjs.com/downloads/knockout-3.2.0.js" type="text/javascript"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/q.js/1.0.0/q.min.js" type="text/javascript"></script>
<script src="src/knockout.combobox.js" type="text/javascript"></script>
<link rel="stylesheet" href="reset.css" />
<link rel="stylesheet" href="css/knockout.combobox.css" />
</head>
<body>
<section>
<div class="combobox clearfix" data-bind="combobox: { dataSource: getData, placeholder: 'Select item' }, comboboxValue: selected"></div>
<div>Selected: <span data-bind="text: selectedName"></span></div>
</section>
<section>
<h3>Sync</h3>
<div class="combobox clearfix" data-bind="combobox: { dataSource: getDataSync, placeholder: 'Select item' }, comboboxValue: selected"></div>
<div>Selected: <span data-bind="text: selectedName"></span></div>
</section>
<section>
<h3>With promises</h3>
<div class="combobox clearfix" data-bind="combobox: { dataSource: getDataPromise, placeholder: 'Select item' }, comboboxValue: selected"></div>
<div>Selected: <span data-bind="text: selectedName"></span></div>
</section>
<section>
<h3>Custom item template</h3>
<div class="combobox clearfix" data-bind="combobox: { dataSource: getData, rowTemplate: 'row-template' }, comboboxValue: selected"></div>
<div>Selected: <span data-bind="text: selectedName"></span></div>
</section>
<script id="row-template" type="text/html">
<span data-bind="text: name"></span><span>Custom template stuff</span>
</script>
<section>
<h3>Client side data</h3>
<div class="combobox clearfix" data-bind="combobox: { dataSource: countries, placeholder: 'Select country' }, comboboxValue: country"></div>
<div>Selected: <span data-bind="text: countryName"></span></div>
</section>
<script src="demo.js" type="text/javascript"></script>
</body>
</html>