I have a list with items and want to delete on swipe. The way i have it now is that when you swipe, it will prompt you whether you want to delete or not. after clicking yes or no the callback function is called. But i can't find out which button is clicked. i pass the index and the button clicked to a new function, but the value of button is always undefined, i do get the index right.
this is in app.views.CustomerList.js:
Code:
itemswipe: function(list, index) {
Ext.dispatch({
controller: app.controllers.customer,
action: 'confirmremove',
index: index,
scope: this
});
}
this is in customer.js:
Code:
confirmremove: function(params) {
var customer = app.stores.customer.getAt(params.index);
// android quirk? doesn't display "message", only title
confirm('Delete?\n' +
customer.data.first + ' ' + customer.data.last + '\n' +
customer.data.address + '\n' +
customer.data.zipcode + ' ' + customer.data.city, this.remove(this.button, params.index));
},
remove: function(btn, index) {
if (btn == 'yes') {
Ext.Msg.alert('yes was clicked on ' + index);
}
}