Dynamic A to Z content list in jQuery Mobile
I'm looking to build an A to Z content list in jQuery Mobile where data is read and grouped dynamically. Is this possible?
I want something like this grouped dynamically from their documentation (which is static):http://jquerymobile.com/demos/1.0a4.1/#docs/lists/lists-divider.html
But what would be really awesome is if I could get the grouping to be with collapsible content...
An开发者_运维知识库y thoughts, examples, or resources out there?
A list divider is itself a list item in jQuery mobile. You'd probably need to do it by hand (insert things into the list alphabetically and put in a list divider <li>
for each letter). And yeah, put click handlers on the list dividers to make them show and hide all the <li>
s under them. So you're aiming for a list structure like:
<ul data-role="listview" data-theme="g">
<li data-role="list-divider">A</li>
<li class="a"><a href="acura.html">Acura</a></li>
<li class="a"><a href="audi.html">Audi</a></li>
<li data-role="list-divider">B</li>
<li class="b"><a href="bmw.html">BMW</a></li>
</ul>
And then attach a click handler on the list divider for A to make it hide all <li>
s with the class "a". But you will have to generate it by hand, till someone writes a plugin to convert an object into a JQM list, if it doesn't exist already.
精彩评论