Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16051] Titanium.UI.ListItem.accessoryView

GitHub Issuen/a
TypeNew Feature
Priorityn/a
StatusReopened
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsTiAPI
Labelsaccessoryview, ios, listview, listviewitem
ReporterTristan Roscoe
AssigneeUnknown
Created2013-09-11T20:28:38.000+0000
Updated2018-02-28T20:03:53.000+0000

Description

Potential use case
var win = Ti.UI.createWindow({backgroundColor: 'white'});
var basicSwitch = Ti.UI.createSwitch({
  value:true
});
basicSwitch.addEventListener('change',function(e){
  Ti.API.info('Switch value: ' + basicSwitch.value);
});
var data = [
    {
        properties: {
            title: 'Title',
            image: 'KS_nav_views.png', // not used by this template
            accessoryView: basicSwitch
        },
        template: Ti.UI.LIST_ITEM_TEMPLATE_DEFAULT
    }
];

var listSection = Ti.UI.createListSection({items: data});
var listView = Ti.UI.createListView({sections: [listSection]});
win.add(listView);
win.open();
Potential Alloy XML Markup
<Alloy>
    <Window backgroundColor="white">
        <ListView id="listView">
            <ListSection>
                <ListItem title="Airplane Mode">
                    <AccessoryView>
                        <Switch id="basicSwitch" value="true" onChange="outputState"/>
                    </AccessoryView>
                </ListItem>
                <ListItem title="Wi-Fi"/>
                <ListItem title="Bluetooth"/>
            </ListSection>
        </ListView>
    </Window>
</Alloy>

Attachments

FileDateSize
photo.PNG2013-09-11T20:28:38.000+000069949

Comments

  1. Mostafizur Rahman 2013-09-20

    Hello, Can you add more details? What you want to add as new features? Thanks
  2. AvtarSingh Suchariya 2013-11-28

    It is saying that the List Item in side the list view show have default property to add Switch as list type as it is available in attached screenshot for Airplane mode. Right now we have subview (>) checkmark (Right sine), etc.
  3. Ritu Agrawal 2013-12-06

    This is a valid feature request so moving it to engineering. Titanium.UI.ListItem.accessoryType currently supports one of the following: Titanium.UI.LIST_ACCESSORY_TYPE_CHECKMARK Titanium.UI.LIST_ACCESSORY_TYPE_DETAIL Titanium.UI.LIST_ACCESSORY_TYPE_DISCLOSURE Titanium.UI.LIST_ACCESSORY_TYPE_NONE (Default) This is a feature request to add Titanium.UI.LIST_ACCESSORY_TYPE_SWITCH to implement the functionality similar to airplane mode on most phones.

JSON Source