Lists

Home Search

Listviews

The listview plugin has the following options:

countTheme string

default: "c"

Sets the color scheme (swatch) for list item count bubbles. It accepts a single letter from a-z that maps to one of the swatches included in your theme. To set the value for all instances of this widget, bind this option to the mobileinit event:

$( document ).bind( "mobileinit", function(){
    $.mobile.listview.prototype.options.countTheme = "a";
});

This option is also exposed as a data attribute: data-count-theme="a".

dividerTheme string

default: "b"

Sets the color scheme (swatch) for list dividers. It accepts a single letter from a-z that maps to one of the swatches included in your theme. To set the value for all instances of this widget, bind this option to the mobileinit event:

$( document ).bind( "mobileinit", function(){
    $.mobile.listview.prototype.options.dividerTheme = "a";
});

This option is also exposed as a data attribute: data-divider-theme="a".

filter boolean

default: false

Adds a search filter bar to listviews. To set the value for all instances of this widget, bind this option to the mobileinit event:

$( document ).bind( "mobileinit", function(){
    $.mobile.listview.prototype.options.filter = true;
});

This option is also exposed as a data attribute: data-filter="true".

filterCallback function

The function to determine which rows to hide when the search filter textbox changes. The function accepts two arguments -- the text of the list item (or data-filtertext value if present), and the search string. Return true to hide the item, false to leave it visible. To set the value for all instances of this widget, bind this option to the mobileinit event:

$( document ).bind( "mobileinit", function(){
    $.mobile.listview.prototype.options.filterCallback = function( text, searchValue ) {
        // only show items that *begin* with the search string
        return text.toLowerCase().substring( 0, searchValue.length ) !== searchValue;
    };
});
filterPlaceholder string

default: "Filter items..."

The placeholder text used in search filter bars. To set the value for all instances of this widget, bind this option to the mobileinit event:

$( document ).bind( "mobileinit", function(){
    $.mobile.listview.prototype.options.filterPlaceholder = "Search...";
});

This option is also exposed as a data attribute: data-filter-placeholder="Search...".

filterTheme string

default: "c"

Sets the color scheme (swatch) for the search filter bar. It accepts a single letter from a-z that maps to one of the swatches included in your theme. To set the value for all instances of this widget, bind this option to the mobileinit event:

$( document ).bind( "mobileinit", function(){
    $.mobile.listview.prototype.options.filterTheme = "a";
});

This option is also exposed as a data attribute: data-filter-theme="a".

headerTheme string

default: "b"

Sets the color scheme (swatch) for headers of nested list sub pages. It accepts a single letter from a-z that maps to one of the swatches included in your theme. To set the value for all instances of this widget, bind this option to the mobileinit event:

$( document ).bind( "mobileinit", function(){
    $.mobile.listview.prototype.options.headerTheme = "a";
});

This option is also exposed as a data attribute: data-header-theme="a".

icon string

default: "arrow-r"

Applies an icon from the icon set to all linked list buttons. To set the value for all instances of this widget, bind this option to the mobileinit event:

$( document ).bind( "mobileinit", function(){
    $.mobile.listview.prototype.options.icon = "star";
});

This option is also exposed as a data attribute: data-icon="star".

initSelector CSS selector string

default: ":jqmData(role='listview')"

This is used to define the selectors (element types, data roles, etc.) that will automatically be initialized as listviews. To change which elements are initialized, bind this option to the mobileinit event:

$( document ).bind( "mobileinit", function(){
    $.mobile.listview.prototype.options.initSelector = ".mylistview";
});
inset boolean

default: false

Adds inset list styles. To set the value for all instances of this widget, bind this option to the mobileinit event:

$( document ).bind( "mobileinit", function(){
    $.mobile.listview.prototype.options.inset = true;
});

This option is also exposed as a data attribute: data-inset="true".

splitIcon string

default: "arrow-r"

Applies an icon from the icon set to all split list buttons. To set the value for all instances of this widget, bind this option to the mobileinit event:

$( document ).bind( "mobileinit", function(){
    $.mobile.listview.prototype.options.splitIcon = "star";
});

This option is also exposed as a data attribute: data-split-icon="star".

splitTheme string

default: "b"

Sets the color scheme (swatch) for split list buttons. It accepts a single letter from a-z that maps to one of the swatches included in your theme. To set the value for all instances of this widget, bind this option to the mobileinit event:

$( document ).bind( "mobileinit", function(){
    $.mobile.listview.prototype.options.splitTheme = "a";
});

This option is also exposed as a data attribute: data-split-theme="a".

theme string

default: null, inherited from parent

Sets the color scheme (swatch) for this widget. It accepts a single letter from a-z that maps to one of the swatches included in your theme. By default, it will inherit the same swatch color as its parent container if not explicitly set. To set the value for all instances of this widget, bind this option to the mobileinit event:

$( document ).bind( "mobileinit", function(){
    $.mobile.listview.prototype.options.theme = "a";
});

This option is also exposed as a data attribute: data-theme="a".