0

我想删除一个带有按钮的行。我有以下代码:

depAgregarButton.addEventListener('click', function(e){
        dataBase('insert', depNamesField.value );
        var databaseObj = new dataBase('query', null),
            data = []; 

        for(var i in databaseObj ){
            var row = Ti.UI.createTableViewRow({
                title: databaseObj[i],
                backgroundColor:'#FFF',
                height: '35dp'
            });

            var label = Ti.UI.createLabel({
                color: '#727072',
                objName: 'label',
                text: databaseObj[i],
                touchEnabled: false,
                left: '12dp',
                width: '250dp',
                font: {
                        fontSize:'12dp',
                        fontFamily:'HelvLight Regular'
                    }
            });

            var buttonDelete = Ti.UI.createButton({
                backgroundImage: '/images/but_x.png',
                width:'30dp',
                height:'30dp',
                right: '8dp',
                clickName:'button'
            });

            data.push(row);
            row.add(label);
            row.add(buttonDelete);      
        };
        table.appendRow(row);
    });

我正在向表中添加行,但我不知道如何使用 deleteButton 删除每一行

4

1 回答 1

0

试试这个

table.addEventListener('click',function(e){
        if(e.source.clickName){
            if(e.source.clickName == 'button'){
               table.deleteRow(e.row);
            }
        }
});
于 2013-10-26T05:44:10.753 回答