简体   繁体   中英

Delete a list view Row Titanium

I want to delete a row in list view. When user clicks a row I want to open a Dialog showing the message that 'sure you want to delete'. When user clicks ok then the Row should be deleted.

listView.addEventListener('itemclick', function(e){ 
    var section = e.section;
    var itenIndex = e.itemIndex;
    var dialog = Ti.UI.createAlertDialog({
        title : 'Do you want to delete the row?',
        buttonNames : ['Yes','No']
    });
    dialog.addEventListener('click', function(e){
        if(e.index == 0){
            section.deleteItemsAt(itenIndex,1);
        }
    });
    dialog.show();
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM