bircastri
bircastri

Reputation: 2159

How to set an event on column of TableView

I'm building an app with appcelerator studio.

I have a TableView with some TableViewRow. So I have the last column that have an ImageView (delete.png), then I want that when the user click on this image, this row it is to delete.

So I have this code for the table:

<Alloy>
    <View class="containerClinicalFolder" >
        <TableView id="table" class="table" onClick="doClick">
            <TableViewSection id="table" >

            </TableViewSection>
        </TableView>

        <Button id="button" class="buttonLanguage" onClick="changeLanguage"
            visible="false" traduzione="true"></Button> 

    </View>
</Alloy>

and this is the event:

function doClick(e){
    if(e.source.apiName == "Ti.UI.ImageView"){
        $.tableContact.deleteRow(e.index);  
    }
}

but not works

Upvotes: 3

Views: 93

Answers (1)

Jason Fetterly
Jason Fetterly

Reputation: 182

I believe that line 3:

<TableView id="table" class="table" onClick="doClick">

Should be

<TableView id="table" class="table" onClick="doClick()">

Upvotes: 0

Related Questions