Search code examples
appceleratorappcelerator-alloy

Any way to set editActions on a ListView with dataCollection?


I have a ListView that's hooked to a dataCollection, is it possible to add editActions?

Can't seem to find a way to add these to my ItemTemplate or ListItem.

Here's my (shortened) view:

<ListView id="listViewSpots" defaultItemTemplate="history">
    <Templates>
        <ItemTemplate name="history" id="itemTemplateHistory" canEdit="true">
            <Label bindId="serie" class="serie" />
        </ItemTemplate>
    </Templates>
    <ListSection id="listSectionSpots" dataCollection="spot" dataFilter="listFilter">
        <ListItem itemId="{id}" serie:text="{serie}" searchableText="{serie}" />
    </ListSection>
</ListView>

Solution

  • You can add custom actions like this:

    "ListItem[platform=ios]":{
    accessoryType: Titanium.UI.LIST_ACCESSORY_TYPE_DISCLOSURE,
    editActions: [{ title: "Add",
                    style: Ti.UI.iOS.ROW_ACTION_STYLE_DEFAULT },
                    { title: "Archive",
                    style: Ti.UI.iOS.ROW_ACTION_STYLE_DEFAULT },]
    }