Created
June 6, 2012 10:41
-
-
Save dhavaln/2881230 to your computer and use it in GitHub Desktop.
jQuery Mobile Listview Filter Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery-1.7.1.js"></script> | |
<script src="http://code.jquery.com/mobile/latest/jquery.mobile.min.js"></script> | |
<link rel="stylesheet" href="http://code.jquery.com/mobile/latest/jquery.mobile.min.css"></link> | |
</head> | |
<body> | |
<div data-role="page" id="home"> | |
<div data-role="header"> | |
<h1>Search Test</h1> | |
</div> | |
<div data-role="content"> | |
<ul data-role="listview" data-filter="true" data-filter-placeholder="Search on user or id..." data-inset="true"> | |
<li data-filtertext="11:first:one"><a href="#">one</a></li> | |
<li data-filtertext="22:second:two"><a href="#">two</a></li> | |
<li data-filtertext="33:third:three"><a href="#">three</a></li> | |
<li data-filtertext="44:fourth:four"><a href="#">four</a></li> | |
</ul> | |
</div> | |
</div> | |
</body> | |
<script> | |
/* | |
// Override filter search | |
$("ul").listview('option', 'filterCallback', function(text, searchValue){ | |
console.log("text " + text + ", search with " + searchValue); | |
console.log(text.toLowerCase().indexOf( searchValue ) === -1); | |
return text.toLowerCase().indexOf( searchValue ) === -1; | |
}); | |
*/ | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment