How to create and render listview with autodividers in a web page using jQuery Mobile

jQuery Mobile allows us to display a list of items in a mobile friendly manner using listview component. The listview in jQuery Mobile comes packed with many features such as making a list filterable (with the help of search box) or grouping list items into various sections using dividers. This comes in handy when you have to render long lists. Here, in this article, I will show you how to implement listview of jQuery Mobile framework and configure it to automatically generate dividers for its items.

Create a new HTML file and add the following code to it:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <title>Listview with autodividers</title>
  <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css">
  <!-- jQuery and jQuery Mobile -->
  <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
  <script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script> 
</head>
<body>
<!-- Home -->
<div data-role="page" id="page1">
    <div data-role="content">
        <ul data-role="listview" data-autodividers="true" data-filter="true" data-inset="true">
          <li><a href="index.html">Arron Gouveia</a></li>
          <li><a href="index.html">Bobette Gregory</a></li>
          <li><a href="index.html">Brian Sarles</a></li>  
          <li><a href="index.html">Hayden Condon</a></li>
          <li><a href="index.html">Jeanmarie Swager</a></li> 
          <li><a href="index.html">Karlyn Bullock</a></li>
          <li><a href="index.html">Katie Jourdan</a></li>
          <li><a href="index.html">Katherina Sakata</a></li>
          <li><a href="index.html">Kieth Mabery</a></li>
          <li><a href="index.html">Lachelle Schrader</a></li>
          <li><a href="index.html">Mammie Hunsicker</a></li>    
          <li><a href="index.html">Marina Ikner</a></li>
          <li><a href="index.html">Misha Vandeusen</a></li>
          <li><a href="index.html">Nakisha Gleeson</a></li>
          <li><a href="index.html">Phillis Summerlin</a></li>  
          <li><a href="index.html">Ronny Heineman</a></li> 
          <li><a href="index.html">Shante Mcshane</a></li>
          <li><a href="index.html">Sherika Marotz</a></li> 
          <li><a href="index.html">Sherri Vancamp</a></li>  
          <li><a href="index.html">Stephen Mantyla</a></li>  
        </ul>
    </div>
</div>
</body>
</html>

Now, open this HTML page on your mobile device. It will look like this:

jQuery Mobile Listview with autodividers

If you type anything in search box, then the list(along with dividers) is filtered accordingly. The dividers are auto generated on the basis of first letter of each item's text.

Searching in listview with autodividers of jQuery Mobile 

Here, to create a listview, we basically create a list, either unordered (ul) or ordered (ol), and set attribute data-role as listview. Next, to enable list to be filterable, we set another attribute data-filter as true. Finally, to automatically generate dividers for this list, we set attribute data-autodividers to true.

        <ul data-role="listview" data-autodividers="true" data-filter="true" data-inset="true">
          <li><a href="index.html">Arron Gouveia</a></li>
          <li><a href="index.html">Bobette Gregory</a></li>
          <li><a href="index.html">Brian Sarles</a></li>  
          <li><a href="index.html">Hayden Condon</a></li>
          <li><a href="index.html">Jeanmarie Swager</a></li> 
          <li><a href="index.html">Karlyn Bullock</a></li>
          <li><a href="index.html">Katie Jourdan</a></li>
          <li><a href="index.html">Katherina Sakata</a></li>
          <li><a href="index.html">Kieth Mabery</a></li>
          <li><a href="index.html">Lachelle Schrader</a></li>
          <li><a href="index.html">Mammie Hunsicker</a></li>    
          <li><a href="index.html">Marina Ikner</a></li>
          <li><a href="index.html">Misha Vandeusen</a></li>
          <li><a href="index.html">Nakisha Gleeson</a></li>
          <li><a href="index.html">Phillis Summerlin</a></li>  
          <li><a href="index.html">Ronny Heineman</a></li> 
          <li><a href="index.html">Shante Mcshane</a></li>
          <li><a href="index.html">Sherika Marotz</a></li> 
          <li><a href="index.html">Sherri Vancamp</a></li>  
          <li><a href="index.html">Stephen Mantyla</a></li>  
        </ul>

Easy, isn't it!? 

   

Comments

Member since:
25 July 2016
Last activity:
1 year 2 weeks

jQuery Mobile allows us to display a list of products in a mobile friendly manner using listview component. The listview in jQuery Mobile comes packed with many features such as creating a list filterable (with usually of search box) or grouping list items into various sections using partitioning.

Roxycodone

Member since:
1 May 2014
Last activity:
3 years 7 weeks

The listview in jQuery Mobile comes packed with many features such as the creation of a filterable list (with the help of search) or grouping list items in compartments with dividers.Pass4sure  VCP-510


Member since:
7 August 2017
Last activity:
10 weeks 15 hours

kanye west shoes

michael kors bags

ua shoes

ray ban erika

prada handbags

payless shoes online

official kate spade website

coach outlet online

pandora rings

pandoracharms

pandora rings uk

Coach Sunglasses Outlet

balenciaga outlet

Engagement Rings - Official

Nike Air Max 180

official michael kors

Ray Ban sunglasses

shoes sale

Nike Air Max

Air Max 180

burberry outlet

Dreamland Jewelry - Official

birkenstock sandals

birkenstock

Nike Air Max Couple

coach outlet online

prada outlet online

louis vuitton outlet online

Nike Air Jordan

gel kayano

official michael kors

michael kors outlet bags

Hugo Boss Store

payless shoes

Premier Jewelry - Official

ray ban outlet

Coach Handbags

pandora sale

coach watches

nike store

football jerseys

louis vuitton outlet online

coach outlet online sale

Add Your Link Free

backlink

louis vuitton us

michael kors

Nike Air Jordan Enfants

michael kors

Michael Kors Handbags Outlet Sale

kate spade outlet online

Green Cleaned

ugg boots

sunglasses

Nike Blazer Femmes

evbid

Wine

coach outlet

birkenstock outlet

Burberry Australia

payless near me

Chanel Outlet

north face sale

Nike Air Max

Prada Shoes - Official

michael kors outlet

ray ban wayfarer sunglasses

Oakley Sunglasses

puma sneakers outlet

payless shoes

nike free shoes

diesel watches

burberry outlet canada

prada sale

puma sneakers sale

louis vuitton outlet

Air Max 180 Homme

Jewelry Armoire - Official

coach handbags sale

Hermes Outlet

timberland shoes

Nike Air Max 2017

coachs outlet

louis vuitton outlet online

Nike Jordans

football jerseys

burberry outlet sale

Nike Free 3.0

michael kors outlet online

ray ban wayfarer

ray ban sunglasses

Rolex Watch

michael kors

michael kors

nike huarache shoes

ray ban sale

Adamson

pandora necklaces

kate spade italy

coach australia

pandora uk

pandora uk

swatch watch

michael kors watches

michael kors

rayban prescription sunglasses

Brighton Jewelry - Official

prada outlet online

Nike Air Force

michael kors outlet

fulam shoes

softball jerseys

Nike Air Max

balenciaga us

Air Max 1 Homme

michael kors

Watches

Air Jordan Enfant

chrome store canada

sunglasses store

coach outlet

michael kors outlet

Nike Free Run

mk outlet online

michael kors outlet

the beat

seiko watches

michael kors

Lifestyle

Air Max 90 Femme

hermes outlet

Nike Air Jordan enfants

hermes outlet

prada purses

kate spade outlet

nike jordan shoes

me adc8.7