Caco Villares Law
Posts: 0
Joined: Fri Mar 15, 2013 5:51 pm

Listview: Autodividers

When using Autodividers, how can i have data-autodividers=full (full text) instead of data-autodividers=alpha (Uppercase First letter)

in other words,

i want to have the full text of the item shown in the divider (eg. all events in March will be under a "March" divider) thank you

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Listview: Autodividers

Hi,

This should help:
http://view.jquerymobile.com/1.2.0/do...

On page show (for static mobilelist) or on complete service (for mobilelist generated from Rest service response) add the following JavaScript code:

codeTiggzi("mobilelistName").listview({
autodividers: true,

&#47;&#47; the selector function is passed a <li> element from the listview;
&#47;&#47; it should return the appropriate divider text for that <li>
&#47;&#47; element as a string
autodividersSelector: function ( li ) {
var liText = li&#46;text();&#47;* get text of li &#47
var out = &#46;&#46;&#46;&#46;&#46;&#46;&#46;&#46;&#46;&#46;&#46;&#46;&#46;&#46;&#46&#47; generate a string based on the content of liText *&#47
return out;
}
})&#46;listview('refresh');
/code

Replace codevar out = &#46;&#46;&#46;&#46;&#46;&#46;&#46;&#46;&#46;&#46;&#46;&#46;&#46;&#46;&#46/codewith the line you need.

Return to “Issues”