Search code examples
titaniumtitanium-alloy

Get the row id in TableViewRow


The following code to print the "local" model in tableview, its working, now my problem is to fetch the row id or row detail by clicking the each row. I have attached the showDetail function on each row to get the row detail.But unable to get the row attch data. How can i achieve this please help me, I really appreciate your answers.

<TableView dataCollection="local">
    <TableViewRow onClick="showDetail">
        <View layout="horizontal">
            <ImageView image="{image}" width="50" height="50"/>
            <Label id="name" text="{title}"></Label>
        </View>
    </TableViewRow>
</TableView>


function showDetail(e){
console.log(e.index);
}

enter image description here


Solution

  • Have a look at the TableView API click Event:

    http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.TableView-event-click

    There are all properties: e.g. index=the number of the row

    And have a look at row and rowData