3

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

bircastri
  • 2,169
  • 13
  • 50
  • 119
  • 1. remove the onclick from the table. 2. in your controller you are adding rows to the tableview. in the createtableviewrow you add a refrence to the row (eg the id of the record) 4. after adding rows you add an Addeventlistener to the tableview – Foxbox Jul 02 '16 at 06:13

1 Answers1

0

I believe that line 3:

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

Should be

<TableView id="table" class="table" onClick="doClick()">
Jason Fetterly
  • 182
  • 1
  • 12
  • no no the method doClick is called, but not works correctly. I have in my table 4 column, the 4° column have the delete image, I want the if the user click on the 4° column the doClick method must delete that row – bircastri Jul 02 '16 at 05:41