# Titanium.UI.ListSection

A list section is a container within a list view used to organize list items.

Availability
3.1.0
3.1.0
9.2.0

# Overview

Use the Titanium.UI.createListSection method or <ListSection> Alloy element to create a ListSection.

List sections are used to manipulate and organize list items contained within it. For examples of using list sections, see the examples in Titanium.UI.ListView and Titanium.UI.ListItem.

# Examples

# Alloy XML Markup

ListSection is supported by Alloy 1.2.0 and later.

HeaderView and FooterView are supported on Alloy 1.3.0 and later.

<Alloy>
    <Window fullscreen="true">
        <ListView>
            <ListSection>

                <!-- Sets ListSection's headerView property -->
                <HeaderView>
                    <View backgroundColor="#DDD" height="Ti.UI.SIZE">
                        <Label>Fruits</Label>
                    </View>>
                </HeaderView>

                <ListItem title="Apple" />
                <ListItem title="Orange" />
                <ListItem title="Pear" />

                <!-- Sets ListSection's footerView property -->
                <FooterView>
                    <View backgroundColor="#DDD" height="Ti.UI.SIZE">
                        <Label>3 items</Label>
                    </View>

                </FooterView>
            </ListSection>
        </ListView>
    </Window>
</Alloy>

# Properties

# filteredItemCount READONLY

Availability
9.3.0
filteredItemCount :Number

Returns the item count of the section, also incorporating the search filter if active.


# footerTitle

Availability
3.1.0
3.1.0
9.2.0
footerTitle :String

Title of this section footer.

Using this property and footerView together is not supported. Use one or the other.


# footerView

Availability
3.2.0
3.2.0
9.2.0
footerView :Titanium.UI.View

View to use for this section footer.

Using this property and footerTitle together is not supported. Use one or the other. In Alloy you can specify this property with a <FooterView> child element of a <ListSection> element (see Examples).


# headerTitle

Availability
3.1.0
3.1.0
9.2.0
headerTitle :String

Title of this section header.

Using this property and headerView together is not supported. Use one or the other.


# headerView

Availability
3.2.0
3.2.0
9.2.0
headerView :Titanium.UI.View

View to use for this section header.

Using this property and headerTitle together is not supported. Use one or the other. In Alloy you can specify this property with a <HeaderView> child element of a <ListSection> element (see Examples).


# itemCount READONLY

Availability
9.3.0
9.3.0
itemCount :Number

Returns the item count of the section.


# items

Availability
3.1.0
3.1.0
9.2.0
items :Array<ListDataItem>

Items of this list section.

# Methods

# appendItems

Availability
3.1.0
3.1.0
9.2.0
appendItems(dataItems[, animation]) void

Appends the data entries to the end of the list section.

On iOS, the list item(s) can be inserted with an animation by specifying the animation parameter.

Parameters

Name Type Description
dataItems Array<ListDataItem>

List items to add.

animation ListViewAnimationProperties

Animation properties. (iOS only.)

Returns

Type
void

# deleteItemsAt

Availability
3.1.0
3.1.0
9.2.0
deleteItemsAt(itemIndex, count[, animation]) void

Removes count entries from the list section at the specified index.

On iOS, the list item(s) can be removed with an animation by specifying the animation parameter.

Parameters

Name Type Description
itemIndex Number

Index of where to remove items.

count Number

Number of items to remove.

animation ListViewAnimationProperties

Animation properties. (iOS only.)

Returns

Type
void

# getItemAt

Availability
3.1.0
3.1.0
9.2.0
getItemAt(itemIndex) ListDataItem

Returns the item entry from the list view at the specified index.

Parameters

Name Type Description
itemIndex Number

Index of where to retrieve an item.

Returns


# insertItemsAt

Availability
3.1.0
3.1.0
9.2.0
insertItemsAt(itemIndex, dataItems[, animation]) void

Inserts data entries to the list section at the specified index.

On iOS, the list item(s) can be inserted with an animation by specifying the animation parameter.

Parameters

Name Type Description
itemIndex Number

Index of where to insert the items.

dataItems Array<ListDataItem>

List items to insert.

animation ListViewAnimationProperties

Animation properties. (iOS only.)

Returns

Type
void

# replaceItemsAt

Availability
3.1.0
3.1.0
9.2.0
replaceItemsAt(index, count, dataItems[, animation]) void

Removes count entries from the list section at the specified index, then inserts data entries to the list section at the same index.

On iOS, the list item(s) can be replaced with an animation by specifying the animation parameter.

Parameters

Name Type Description
index Number

Index of where to remove then insert items.

count Number

Number of list items to remove.

dataItems Array<ListDataItem>

List items to insert.

animation ListViewAnimationProperties

Animation properties. (iOS only.)

Returns

Type
void

# setItems

Availability
3.1.0
3.1.0
9.2.0
setItems(dataItems[, animation]) void

Sets the data entries in the list section.

On iOS, the list item(s) can be inserted with an animation by specifying the animation parameter.

Parameters

Name Type Description
dataItems Array<ListDataItem>

List items to set.

animation ListViewAnimationProperties

Animation properties. (iOS only.)

Returns

Type
void

# updateItemAt

Availability
3.1.0
3.1.0
9.2.0
updateItemAt(index, dataItem[, animation]) void

Updates an item at the specified index.

On iOS, the list item can be updated with an animation by specifying the animation parameter.

Parameters

Name Type Description
index Number

Index of where to update the item.

dataItem ListDataItem

List item to update.

animation ListViewAnimationProperties

Animation properties. (iOS only.)

Returns

Type
void