# Titanium.UI.ListSection
A list section is a container within a list view used to organize list items.
# 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
Returns the item count of the section, also incorporating the search filter if active.
# footerTitle
Title of this section footer.
Using this property and footerView
together is not supported. Use one or the other.
# footerView
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
Title of this section header.
Using this property and headerView
together is not supported. Use one or the other.
# headerView
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).
# 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
Name | Type | Description |
---|---|---|
dataItems | Array<ListDataItem> | List items to add. |
animation | ListViewAnimationProperties | Animation properties. (iOS only.) |
Returns
- Type
- void
# 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
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
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
- Type
- 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
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
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
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
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