Properties Methods Events Config Options Direct Link

Class Ext.IndexBar

Package:Ext
Defined In:IndexBar.js
Class:IndexBar
Extends:Object

IndexBar is a component used to display a list of data (primarily an alphabet) which can then be used to quickly navigate through a list (see Ext.List) of data. When a user taps on an item in the Ext.IndexBar, it will fire the index event.

Screenshot:

Example code:

Here is an example of the usage in a Ext.List:

Ext.regModel('Contact', {
    fields: ['firstName', 'lastName']
});

var store = new Ext.data.JsonStore({
    model  : 'Contact',
    sorters: 'lastName',

    getGroupString : function(record) {
        return record.get('lastName')[0];
    },

    data: [
        {firstName: 'Tommy',   lastName: 'Maintz'},
        {firstName: 'Rob',     lastName: 'Dougan'},
        {firstName: 'Ed',      lastName: 'Spencer'},
        {firstName: 'Jamie',   lastName: 'Avins'},
        {firstName: 'Aaron',   lastName: 'Conran'},
        {firstName: 'Dave',    lastName: 'Kaneda'},
        {firstName: 'Michael', lastName: 'Mullany'},
        {firstName: 'Abraham', lastName: 'Elias'},
        {firstName: 'Jay',     lastName: 'Robinson'},
        {firstName: 'Tommy',   lastName: 'Maintz'},
        {firstName: 'Rob',     lastName: 'Dougan'},
        {firstName: 'Ed',      lastName: 'Spencer'},
        {firstName: 'Jamie',   lastName: 'Avins'},
        {firstName: 'Aaron',   lastName: 'Conran'},
        {firstName: 'Dave',    lastName: 'Kaneda'},
        {firstName: 'Michael', lastName: 'Mullany'},
        {firstName: 'Abraham', lastName: 'Elias'},
        {firstName: 'Jay',     lastName: 'Robinson'}
    ]
});

var list = new Ext.List({
    tpl: '<tpl for="."><div class="contact">{firstName} <strong>{lastName}</strong></div></tpl>',

    itemSelector: 'div.contact',
    singleSelect: true,
    grouped     : true,
    indexBar    : true,

    store: store,

    floating     : true,
    width        : 350,
    height       : 370,
    centered     : true,
    modal        : true,
    hideOnMaskTap: false
});
list.show();

Alternatively you can initate the Ext.IndexBar component manually in a custom component by using something similar to the following example:

var indexBar = new Ext.IndexBar({
    dock    : 'right',
    overlay : true,
    alphabet: true
});

Config Options

Config OptionsDefined By
 alphabet : Boolean
true to use the letters property to show a list of the alphabet. Should not be used in conjunction with store.
IndexBar
 componentCls : String
Base CSS class Defaults to 'x-indexbar'
IndexBar
 direction : String
Layout direction, can be either 'vertical' or 'horizontal' Defaults to 'vertical'
IndexBar
 itemSelector : String
Required. A simple CSS selector (e.g. div.x-indexbar-item for items
IndexBar
 letters : Array
The letters to show on the index bar. Defaults to the English alphabet, A-Z.
IndexBar
 listPrefix : String
The prefix string to be appended at the beginning of the list. E.g: useful to add a "#" prefix before numbers
IndexBar
 tpl : String
Template for items
IndexBar

Public Properties

This class has no public properties.

Public Methods

MethodDefined By

Public Events

EventDefined By