示例:
disclose: function (list, record, node, index, event) {
Ext.Msg.confirm('Delete Requirement', 'Are you sure?', function (id, value) {
if (id === 'yes') {
console.log('confirmed');
// no access to list, record, node, ... here, why?
}
}, this);
event.stopEvent();
}
如何在确认消息处理程序中访问列表并记录变量?
答案 0 :(得分:2)
disclose: function (list, record, node, index, event) {
var l = list, r = record, n = node, i = index, e = event;
Ext.Msg.confirm('Delete Requirement', 'Are you sure?', function (id, value) {
if (id === 'yes') {
console.log('confirmed', l, r, n, i, e);
}
}, this);
event.stopEvent();
}
答案 1 :(得分:1)
我找到了一个解决方案:
disclose: function (list, record, node, index, event) {
(new Ext.MessageBox).show({
title: 'Delete Requirement',
message: 'Are you sure?',
list: list,
record: record,
buttons: Ext.MessageBox.YESNO,
promptConfig: false,
fn: function (id, value, opt) {
if (id === 'yes') {
opt.record.destroy();
}
}
});
event.stopEvent();
}