Debian Codegraph @

example/demo-groupTemplate_v1.html

raw
1 <!doctype html>
2
3 <html lang="en">
4 <head>
5 <meta charset="utf-8">
6
7 <title></title>
8 <meta name="description" content="">
9 <meta name="author" content="">
10
11 <link rel="stylesheet" href="../src/jquery.typeahead.css">
12
13 <script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
14 <!--script src="../dist/jquery.typeahead.min.js"></script-->
15 <script src="../src/jquery.typeahead.js"></script>
16
17 </head>
18 <body>
19
20 <div style="width: 100%; max-width: 800px; margin: 0 auto;">
21
22 <h1>groupTemplate_v1 Demo</h1>
23
24 <ul>
25 <li>
26 <a href="http://www.runningcoder.org/jquerytypeahead/documentation/">Documentation</a>
27 </li>
28 <li>
29 <a href="http://www.runningcoder.org/jquerytypeahead/demo/">Demos</a>
30 </li>
31 </ul>
32
33 <form>
34 <div class="typeahead__container">
35 <div class="typeahead__field">
36 <div class="typeahead__query">
37 <input class="js-typeahead"
38 name="q"
39 autofocus
40 autocomplete="off">
41 </div>
42 <div class="typeahead__button">
43 <button type="submit">
44 <span class="typeahead__search-icon"></span>
45 </button>
46 </div>
47 </div>
48 </div>
49 </form>
50
51 <script>
52
53 typeof $.typeahead === 'function' && $.typeahead({
54 input: ".js-typeahead",
55 minLength: 0,
56 maxItem: 0,
57 generateOnLoad: true,
58 groupOrder: "desc",
59 groupTemplate: "<table><tr><td>{{group}}</td></tr></table>",
60 source: {
61 group_one: {
62 data: ['group_one_data_one', 'group_one_data_two', 'group_one_data_three', 'group_one_data_four']
63 },
64 group_two: {
65 data: ['group_two_data_one', 'group_two_data_two', 'group_two_data_three', 'group_two_data_four', 'group_two_data_five']
66 },
67 group_three: {
68 data: ['group_three_data_one', 'group_three_data_two', 'group_three_data_three', 'group_three_data_four']
69 }
70 }
71 // maxItem: 12,
72 // maxItemPerGroup: 6,
73 // order: "asc",
74 // hint: true,
75 // searchOnFocus: true,
76 // groupTemplate: "" +
77 // "<table>" +
78 // "<tr>" +
79 // "<td>{{group_one}}</td>" +
80 // "<td>{{group_two}}</td>" +
81 // "<td>{{group_three}}</td>" +
82 // "</tr>" +
83 // "</table>",
84 // source: {
85 // group_one: {
86 // data: ['group_one_data_one', 'group_one_data_two', 'group_one_data_three', 'group_one_data_four']
87 // },
88 // group_two: {
89 // data: ['group_two_data_one', 'group_two_data_two', 'group_two_data_three', 'group_two_data_four']
90 // },
91 // group_three: {
92 // data: ['group_three_data_one', 'group_three_data_two', 'group_three_data_three', 'group_three_data_four']
93 // }
94 // }
95 });
96
97 </script>
98
99 </div>
100
101 </body>
102 </html>