corrade-http-templates – Blame information for rev 57
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
57 | office | 1 | <!doctype html> |
2 | <html lang="en"> |
||
3 | <head> |
||
4 | <meta charset="utf-8"> |
||
5 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
||
6 | <title>jQuery UI Autocomplete - Categories</title> |
||
7 | <link rel="stylesheet" href="../../themes/base/all.css"> |
||
8 | <link rel="stylesheet" href="../demos.css"> |
||
9 | <style> |
||
10 | .ui-autocomplete-category { |
||
11 | font-weight: bold; |
||
12 | padding: .2em .4em; |
||
13 | margin: .8em 0 .2em; |
||
14 | line-height: 1.5; |
||
15 | } |
||
16 | </style> |
||
17 | <script src="../../external/requirejs/require.js"></script> |
||
18 | <script src="../bootstrap.js"> |
||
19 | $.widget( "custom.catcomplete", $.ui.autocomplete, { |
||
20 | _create: function() { |
||
21 | this._super(); |
||
22 | this.widget().menu( "option", "items", "> :not(.ui-autocomplete-category)" ); |
||
23 | }, |
||
24 | _renderMenu: function( ul, items ) { |
||
25 | var that = this, |
||
26 | currentCategory = ""; |
||
27 | $.each( items, function( index, item ) { |
||
28 | var li; |
||
29 | if ( item.category != currentCategory ) { |
||
30 | ul.append( "<li class='ui-autocomplete-category'>" + item.category + "</li>" ); |
||
31 | currentCategory = item.category; |
||
32 | } |
||
33 | li = that._renderItemData( ul, item ); |
||
34 | if ( item.category ) { |
||
35 | li.attr( "aria-label", item.category + " : " + item.label ); |
||
36 | } |
||
37 | }); |
||
38 | } |
||
39 | }); |
||
40 | var data = [ |
||
41 | { label: "anders", category: "" }, |
||
42 | { label: "andreas", category: "" }, |
||
43 | { label: "antal", category: "" }, |
||
44 | { label: "annhhx10", category: "Products" }, |
||
45 | { label: "annk K12", category: "Products" }, |
||
46 | { label: "annttop C13", category: "Products" }, |
||
47 | { label: "anders andersson", category: "People" }, |
||
48 | { label: "andreas andersson", category: "People" }, |
||
49 | { label: "andreas johnson", category: "People" } |
||
50 | ]; |
||
51 | |||
52 | $( "#search" ).catcomplete({ |
||
53 | delay: 0, |
||
54 | source: data |
||
55 | }); |
||
56 | </script> |
||
57 | </head> |
||
58 | <body> |
||
59 | |||
60 | <label for="search">Search: </label> |
||
61 | <input id="search"> |
||
62 | |||
63 | <div class="demo-description"> |
||
64 | <p>A categorized search result. Try typing "a" or "n".</p> |
||
65 | </div> |
||
66 | </body> |
||
67 | </html> |