Skip to content

Titanium.UI.ListSection

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.

Extends: Titanium.Proxy · Since: 3.1.0 · Platforms: android, ipad, iphone, macos

Properties #

apiName#

extended

Type: String

The name of the API that this proxy corresponds to.

The value of this property is the fully qualified name of the API. For example, Button
returns Ti.UI.Button.

filteredItemCount#

Type: Number

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

footerTitle#

Type: String

Title of this section footer.

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

footerView#

Type: 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#

Type: String

Title of this section header.

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

headerView#

Type: 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#

Type: Number

Returns the item count of the section.

items#

Type: Array<ListDataItem>

Items of this list section.

lifecycleContainer#

extended

Type: Titanium.UI.Window, Titanium.UI.TabGroup

The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.

If this property is set to a Window or TabGroup, then the corresponding Activity lifecycle event callbacks
will also be called on the proxy. Proxies that require the activity lifecycle will need this property set
to the appropriate containing Window or TabGroup.

Methods #

appendItems #

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:
NameTypeSummaryOptional
dataItemsArray<ListDataItem>List items to add.No
animationListViewAnimationPropertiesAnimation properties. (iOS only.)Yes

applyProperties #

extended

Applies the properties to the proxy.

Properties are supplied as a dictionary. Each key-value pair in the object is applied to the proxy such that
myproxy[key] = value.

Parameters:
NameTypeSummaryOptional
propsDictionaryA dictionary of properties to apply.No

deleteItemsAt #

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:
NameTypeSummaryOptional
itemIndexNumberIndex of where to remove items.No
countNumberNumber of items to remove.No
animationListViewAnimationPropertiesAnimation properties. (iOS only.)Yes

getItemAt #

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

Parameters:
NameTypeSummaryOptional
itemIndexNumberIndex of where to retrieve an item.No

Returns: ListDataItem

insertItemsAt #

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:
NameTypeSummaryOptional
itemIndexNumberIndex of where to insert the items.No
dataItemsArray<ListDataItem>List items to insert.No
animationListViewAnimationPropertiesAnimation properties. (iOS only.)Yes

replaceItemsAt #

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:
NameTypeSummaryOptional
indexNumberIndex of where to remove then insert items.No
countNumberNumber of list items to remove.No
dataItemsArray<ListDataItem>List items to insert.No
animationListViewAnimationPropertiesAnimation properties. (iOS only.)Yes

setItems #

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:
NameTypeSummaryOptional
dataItemsArray<ListDataItem>List items to set.No
animationListViewAnimationPropertiesAnimation properties. (iOS only.)Yes

updateItemAt #

Updates an item at the specified index.

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

Parameters:
NameTypeSummaryOptional
indexNumberIndex of where to update the item.No
dataItemListDataItemList item to update.No
animationListViewAnimationPropertiesAnimation properties. (iOS only.)Yes

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>

Titanium SDK Documentation