I guess your problem is that you can't retrieve the record from the handler function like you're doing with this.getRecord()
You could update your button with the age too, then retrieve it to show the alert, something like:
{
xtype: 'button',
handler: function(button, e) {
console.log("buttonTapped");
Ext.Msg.alert(
button.getText(), // the title of the alert
"The age of this person is: " + button.getAge(); // the message of the alert
);
},
text: 'MyButton',
age: null
},
And:
updateRecord: function(record) {
// Provide an implementation to update this container's child items
var button = this.down('button');
button.setText(record.get('name'));
button.setAge(record.get('age'));
}
Even better it would be to store the info, or a reference to the record in a more appropriate place, like the ListItem
itself maybe? But this should make it work.