Skip to content
This repository
Browse code

Document data-filtertext attribute

  • Loading branch information...
commit 37499c4df9275b8f24dea2f445141deb1dd244f9 1 parent 47cf8d6
Jake Boone authored November 24, 2011
4  docs/api/data-attributes.html
@@ -291,6 +291,10 @@
291 291
 			<p>LI within a listview</p>
292 292
 			<table>
293 293
 				<tr>
  294
+					<th>data-filtertext</th>
  295
+					<td>string (filter by this value instead of inner text)</td>
  296
+				</tr>
  297
+				<tr>
294 298
 					<th>data-icon</th>
295 299
 					<td>home | delete | plus | arrow-u | arrow-d | check | gear | grid | star | custom | arrow-r | arrow-l | minus | refresh | forward | back | alert | info | search</td>
296 300
 				</tr>
10  docs/lists/docs-lists.html
@@ -73,13 +73,11 @@
73 73
       <p>If you want to change the way in which list items are filtered, ie fuzzy search or matching from the beginning of the string, you can configure the callback used internally by defining <code>$.mobile.listview.prototype.options.filterCallback</code> during <code>mobileinit</code> or after the widget has been created with <code>$("#mylist").listview('option', 'filterCallback', yourFilterFunction)</code>. Any function defined for the callback will be provided two arguments. First, the text of the current list item and second, the value being searched for. A truthy value will result in a hidden list item. The default callback which filters entries without the <code>searchValue</code> as a substring is described below:
74 74
       </p>
75 75
 
76  
-      <pre>
77  
-        <code>
78  
-function( text, searchValue ){
  76
+<pre><code>function( text, searchValue ){
79 77
   return text.toLowerCase().indexOf( searchValue ) === -1;
80  
-};
81  
-        </code>
82  
-      </pre>
  78
+};</code></pre>
  79
+
  80
+			<p>To filter list items by values other than the text, add a <code>data-filtertext</code> attribute to the list item.  The value of this attribute will be passed as the first argument to the <code>filterCallback</code> function instead of the text.</p>
83 81
 
84 82
 			<h2>Text formatting &amp; counts</h2>
85 83
 			<p>The framework includes text formatting conventions for common list patterns like header/descriptions, secondary information and counts through semantic HTML markup.</p>

0 notes on commit 37499c4

Please sign in to comment.
Something went wrong with that request. Please try again.