The listview plugin has the following options:
countTheme
stringdefault: "c"
Sets the color scheme (swatch) for list item count bubbles. It accepts a single letter from a-z that maps to 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
stringdefault: "b"
Sets the color scheme (swatch) for list dividers. It accepts a single letter from a-z that maps to 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
booleandefault: 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
functionThe 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
stringdefault: "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
stringdefault: "c"
Sets the color scheme (swatch) for the search filter bar. It accepts a single letter from a-z that maps to 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
stringdefault: "b"
Sets the color scheme (swatch) for headers of nested list sub pages. It accepts a single letter from a-z that maps to 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"
.
initSelector
CSS selector stringdefault: ":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
booleandefault: 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
stringdefault: "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
stringdefault: "b"
Sets the color scheme (swatch) for split list buttons. It accepts a single letter from a-z that maps to 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
stringdefault: null, inherited from parent
Sets the color scheme (swatch) for this widget. It accepts a single letter from a-z that maps to 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"
.