# Titanium.UI.ListSection

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

- Source: https://titaniumsdk.com/docs/sdk/12.7.0/Titanium.UI.ListSection
- Titanium SDK version: 12.7.0
- Kind: proxy
- Platforms: Android, iPhone, iPad, macOS
- Since: Titanium SDK 3.1.0
- Extends: Titanium.Proxy
- Inheritance: Titanium.Proxy

Use the [Titanium.UI.createListSection](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#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](https://titaniumsdk.com/docs/sdk/Titanium.UI.ListView.md) and [Titanium.UI.ListItem](https://titaniumsdk.com/docs/sdk/Titanium.UI.ListItem.md).

## Example: 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.

``` xml
<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

- Type: Number
- Platforms: Android
- Since: Titanium SDK 9.3.0
- Permission: read-only

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

### footerTitle

- Type: String
- Platforms: Android, iPhone, iPad, macOS

Title of this section footer.

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

### footerView

- Type: Titanium.UI.View
- Platforms: Android, iPhone, iPad, macOS
- Since: Titanium SDK 3.2.0

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
- Platforms: Android, iPhone, iPad, macOS

Title of this section header.

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

### headerView

- Type: Titanium.UI.View
- Platforms: Android, iPhone, iPad, macOS
- Since: Titanium SDK 3.2.0

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
- Platforms: Android, iPhone, iPad
- Since: Titanium SDK 9.3.0
- Permission: read-only

Returns the item count of the section.

### items

- Type: Array<ListDataItem>
- Platforms: Android, iPhone, iPad, macOS

Items of this list section.

## Methods

### appendItems

- Platforms: Android, iPhone, iPad, macOS

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:

- `dataItems` (Array<ListDataItem>): List items to add.
- `animation` (ListViewAnimationProperties, optional): Animation properties. (iOS only.)

### deleteItemsAt

- Platforms: Android, iPhone, iPad, macOS

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:

- `itemIndex` (Number): Index of where to remove items.
- `count` (Number): Number of items to remove.
- `animation` (ListViewAnimationProperties, optional): Animation properties. (iOS only.)

### getItemAt

- Platforms: Android, iPhone, iPad, macOS

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

Parameters:

- `itemIndex` (Number): Index of where to retrieve an item.

Returns: ListDataItem

### insertItemsAt

- Platforms: Android, iPhone, iPad, macOS

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:

- `itemIndex` (Number): Index of where to insert the items.
- `dataItems` (Array<ListDataItem>): List items to insert.
- `animation` (ListViewAnimationProperties, optional): Animation properties. (iOS only.)

### replaceItemsAt

- Platforms: Android, iPhone, iPad, macOS

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:

- `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, optional): Animation properties. (iOS only.)

### setItems

- Platforms: Android, iPhone, iPad, macOS

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:

- `dataItems` (Array<ListDataItem>): List items to set.
- `animation` (ListViewAnimationProperties, optional): Animation properties. (iOS only.)

### updateItemAt

- Platforms: Android, iPhone, iPad, macOS

Updates an item at the specified index.

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

Parameters:

- `index` (Number): Index of where to update the item.
- `dataItem` (ListDataItem): List item to update.
- `animation` (ListViewAnimationProperties, optional): Animation properties. (iOS only.)

## Inherited members

3 members are inherited. Each is documented on the type that declares it.

- [Titanium.Proxy](https://titaniumsdk.com/docs/sdk/12.7.0/Titanium.Proxy.md): `apiName`, `applyProperties`, `lifecycleContainer`

---

- This corpus documents Titanium SDK 13.4.1. Anything here that does not name a version describes 13.4.1.
- Titanium is maintained by TiDev. The Appcelerator toolchain is retired: there is no `appc` CLI, no Appcelerator Studio and no hosted build service. The supported CLI is `titanium` on npm, invoked as `ti`.

