|
26 | 26 |
|
27 | 27 | <h1>Autocomplete</h1>
|
28 | 28 |
|
29 |
| - <p>An autocomplete widget backed by either local or remote data can be created by leveraging the filter feature. |
30 |
| - </p> |
| 29 | + <p>An autocomplete widget backed by either local or remote data can be created by using the <a href="../filterable/" data-ajax="false">Filterable widget</a> on a listview.</p> |
31 | 30 |
|
32 | 31 | <h2>Remote data</h2>
|
33 | 32 |
|
34 | 33 | <p>To use the filter as an autocomplete that taps into remote data sources, you can use the <code>filterablebeforefilter</code> event to dynamically populate a listview as a user types a search query: <a href="../listview-autocomplete-remote/" data-ajax="false">Remote autocomplete demo</a></p>
|
35 | 34 |
|
36 | 35 | <h2>Local data</h2>
|
37 | 36 |
|
38 |
| - <p>The filter reveal feature makes it easy to build a simple autocomplete with local data. When a filterable list has the <code>data-filter-reveal="true"</code>, it will auto-hide all the list items when the search field is blank. The <code>data-filter-placeholder</code> attribute can be added to specify the placeholder text for the filter.</p> |
| 37 | + <p>The filter reveal feature of the Filterable widget makes it easy to build a simple autocomplete with local data. When the Filterable widget is used on a list that has the <code>data-filter-reveal="true"</code> attribute, it will auto-hide all the list items when the search field is blank.</p> |
39 | 38 | <p>Any filter with more than 100-200 items may be slow to perform on a mobile device so we recommend using this feature for autocomplete situations with a relatively small number of items.</p>
|
40 | 39 |
|
41 | 40 | <h3>Full width listview (non-inset)</h3>
|
42 | 41 |
|
43 | 42 | <div data-demo-html="true">
|
44 |
| - <ul data-role="listview" data-filter="true" data-filter-reveal="true" data-filter-placeholder="Search cars..."> |
| 43 | + <form class="ui-filterable"> |
| 44 | + <input id="autocomplete-input" data-type="search" placeholder="Search cars..."> |
| 45 | + </form> |
| 46 | + <ul data-role="listview" data-filter="true" data-filter-reveal="true" data-input="#autocomplete-input"> |
45 | 47 | <li><a href="#">Acura</a></li>
|
46 | 48 | <li><a href="#">Audi</a></li>
|
47 | 49 | <li><a href="#">BMW</a></li>
|
|
69 | 71 |
|
70 | 72 | <h3>Inset listiew</h3>
|
71 | 73 | <div data-demo-html="true">
|
72 |
| - <ul data-role="listview" data-inset="true" data-filter="true" data-filter-reveal="true" data-filter-placeholder="Search cars..."> |
| 74 | + <form class="ui-filterable"> |
| 75 | + <input id="inset-autocomplete-input" data-type="search" placeholder="Search cars..."> |
| 76 | + </form> |
| 77 | + <ul data-role="listview" data-inset="true" data-filter="true" data-filter-reveal="true" data-input="#inset-autocomplete-input"> |
73 | 78 | <li><a href="#">Acura</a></li>
|
74 | 79 | <li><a href="#">Audi</a></li>
|
75 | 80 | <li><a href="#">BMW</a></li>
|
|
104 | 109 | <li <strong>data-filtertext="USA U.S.A. United States of America"</strong>><a href="#">United States</a></li>
|
105 | 110 | </code></pre>
|
106 | 111 |
|
107 |
| - <ul data-role="listview" data-filter="true" data-filter-placeholder="Search ticker or firm name..." data-inset="true"> |
108 |
| - <li data-filtertext="NASDAQ:ADBE Adobe Systems Incorporated"><a href="#">Adobe</a></li> |
109 |
| - <li data-filtertext="NASDAQ:AMZNL Amazon.com, Inc."><a href="#">Amazon</a></li> |
110 |
| - <li data-filtertext="NASDAQ:AAPL Apple Inc."><a href="#">Apple</a></li> |
111 |
| - <li data-filtertext="NASDAQ:GOOG Google Inc."><a href="#">Google</a></li> |
112 |
| - <li data-filtertext="NYSE:IBM Intl. International Business Machines Corp."><a href="#">IBM</a></li> |
113 |
| - <li data-filtertext="NASDAQ:MSFT Microsoft Corporation"><a href="#">Microsoft</a></li> |
114 |
| - <li data-filtertext="NASDAQ:YHOO Yahoo! Inc."><a href="#">Yahoo</a></li> |
115 |
| - <li data-filtertext="USA U.S.A. United States of America"><a href="#">United States</a></li> |
116 |
| - </ul> |
| 112 | + <div data-demo-html="true"> |
| 113 | + <form class="ui-filterable"> |
| 114 | + <input id="rich-autocomplete-input" data-type="search" placeholder="Search ticker or firm name..."> |
| 115 | + </form> |
| 116 | + <ul data-role="listview" data-filter="true" data-inset="true" data-input="#rich-autocomplete-input"> |
| 117 | + <li data-filtertext="NASDAQ:ADBE Adobe Systems Incorporated"><a href="#">Adobe</a></li> |
| 118 | + <li data-filtertext="NASDAQ:AMZNL Amazon.com, Inc."><a href="#">Amazon</a></li> |
| 119 | + <li data-filtertext="NASDAQ:AAPL Apple Inc."><a href="#">Apple</a></li> |
| 120 | + <li data-filtertext="NASDAQ:GOOG Google Inc."><a href="#">Google</a></li> |
| 121 | + <li data-filtertext="NYSE:IBM Intl. International Business Machines Corp."><a href="#">IBM</a></li> |
| 122 | + <li data-filtertext="NASDAQ:MSFT Microsoft Corporation"><a href="#">Microsoft</a></li> |
| 123 | + <li data-filtertext="NASDAQ:YHOO Yahoo! Inc."><a href="#">Yahoo</a></li> |
| 124 | + <li data-filtertext="USA U.S.A. United States of America"><a href="#">United States</a></li> |
| 125 | + </ul> |
| 126 | + </div><!--/demo-html --> |
117 | 127 |
|
118 | 128 | </div><!-- /content -->
|
119 | 129 |
|
|
0 commit comments