Skip to content
Titanium SDK
Version12.7.1

You are reading 12.7.1. See this page in 13.4.1.

Titanium.UI.ListSection

proxyAndroidiPhoneiPadmacOSsince 3.1.0

Extends Titanium.Proxy

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

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 9

apiName

Stringsince Android 3.2.0, iPhone 3.2.0, iPad 3.2.0, macOS 9.2.0read-only

Inherited from Titanium.Proxy

The name of the API that this proxy corresponds to.

filteredItemCount

NumberAndroidsince 9.3.0read-only

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

Title of this section footer.

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

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).

Title of this section header.

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

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

NumberAndroidiPhoneiPadsince 9.3.0read-only

Returns the item count of the section.

Methods 8

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
ParametersTypeDescription
dataItemsArray<ListDataItem>

List items to add.

animation?ListViewAnimationProperties

Animation properties. (iOS only.)

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
ParametersTypeDescription
itemIndexNumber

Index of where to remove items.

countNumber

Number of items to remove.

animation?ListViewAnimationProperties

Animation properties. (iOS only.)

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

Parameters
ParametersTypeDescription
itemIndexNumber

Index of where to retrieve an item.

Returns ListDataItem

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
ParametersTypeDescription
itemIndexNumber

Index of where to insert the items.

dataItemsArray<ListDataItem>

List items to insert.

animation?ListViewAnimationProperties

Animation properties. (iOS only.)

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
ParametersTypeDescription
indexNumber

Index of where to remove then insert items.

countNumber

Number of list items to remove.

dataItemsArray<ListDataItem>

List items to insert.

animation?ListViewAnimationProperties

Animation properties. (iOS only.)

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
ParametersTypeDescription
dataItemsArray<ListDataItem>

List items to set.

animation?ListViewAnimationProperties

Animation properties. (iOS only.)

Updates an item at the specified index.

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

Parameters
ParametersTypeDescription
indexNumber

Index of where to update the item.

dataItemListDataItem

List item to update.

animation?ListViewAnimationProperties

Animation properties. (iOS only.)