Mercurial > hg > ismi-richfaces
comparison src/main/webapp/imageServer/resources/js/jquery-ui-1.10.4/demos/autocomplete/custom-data.html @ 7:764f47286679
(none)
author | jurzua |
---|---|
date | Wed, 29 Oct 2014 14:28:34 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
6:ded3bccf2cf9 | 7:764f47286679 |
---|---|
1 <!doctype html> | |
2 <html lang="en"> | |
3 <head> | |
4 <meta charset="utf-8"> | |
5 <title>jQuery UI Autocomplete - Custom data and display</title> | |
6 <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css"> | |
7 <script src="../../jquery-1.10.2.js"></script> | |
8 <script src="../../ui/jquery.ui.core.js"></script> | |
9 <script src="../../ui/jquery.ui.widget.js"></script> | |
10 <script src="../../ui/jquery.ui.position.js"></script> | |
11 <script src="../../ui/jquery.ui.menu.js"></script> | |
12 <script src="../../ui/jquery.ui.autocomplete.js"></script> | |
13 <link rel="stylesheet" href="../demos.css"> | |
14 <style> | |
15 #project-label { | |
16 display: block; | |
17 font-weight: bold; | |
18 margin-bottom: 1em; | |
19 } | |
20 #project-icon { | |
21 float: left; | |
22 height: 32px; | |
23 width: 32px; | |
24 } | |
25 #project-description { | |
26 margin: 0; | |
27 padding: 0; | |
28 } | |
29 </style> | |
30 <script> | |
31 $(function() { | |
32 var projects = [ | |
33 { | |
34 value: "jquery", | |
35 label: "jQuery", | |
36 desc: "the write less, do more, JavaScript library", | |
37 icon: "jquery_32x32.png" | |
38 }, | |
39 { | |
40 value: "jquery-ui", | |
41 label: "jQuery UI", | |
42 desc: "the official user interface library for jQuery", | |
43 icon: "jqueryui_32x32.png" | |
44 }, | |
45 { | |
46 value: "sizzlejs", | |
47 label: "Sizzle JS", | |
48 desc: "a pure-JavaScript CSS selector engine", | |
49 icon: "sizzlejs_32x32.png" | |
50 } | |
51 ]; | |
52 | |
53 $( "#project" ).autocomplete({ | |
54 minLength: 0, | |
55 source: projects, | |
56 focus: function( event, ui ) { | |
57 $( "#project" ).val( ui.item.label ); | |
58 return false; | |
59 }, | |
60 select: function( event, ui ) { | |
61 $( "#project" ).val( ui.item.label ); | |
62 $( "#project-id" ).val( ui.item.value ); | |
63 $( "#project-description" ).html( ui.item.desc ); | |
64 $( "#project-icon" ).attr( "src", "images/" + ui.item.icon ); | |
65 | |
66 return false; | |
67 } | |
68 }) | |
69 .data( "ui-autocomplete" )._renderItem = function( ul, item ) { | |
70 return $( "<li>" ) | |
71 .append( "<a>" + item.label + "<br>" + item.desc + "</a>" ) | |
72 .appendTo( ul ); | |
73 }; | |
74 }); | |
75 </script> | |
76 </head> | |
77 <body> | |
78 | |
79 <div id="project-label">Select a project (type "j" for a start):</div> | |
80 <img id="project-icon" src="images/transparent_1x1.png" class="ui-state-default" alt=""> | |
81 <input id="project"> | |
82 <input type="hidden" id="project-id"> | |
83 <p id="project-description"></p> | |
84 | |
85 <div class="demo-description"> | |
86 <p>You can use your own custom data formats and displays by simply overriding the default focus and select actions.</p> | |
87 <p>Try typing "j" to get a list of projects or just press the down arrow.</p> | |
88 </div> | |
89 </body> | |
90 </html> |