I have I view that extends Ext.grid.Panel and I want to be able to ask the user if he really wants to close the panel after he clicks [X]. I tried with
listeners: {
beforedestroy: function() {
//console.log('In');
return false;
}
},
but obviously it’s not that simple. Any ideas on how to prevent the closing of the panel?
Thanks
Leron
P.S.
This is what I get from sencha forums, haven’t test it yet:
Ext.create( 'Ext.window.Window', {
title: 'test',
width: 200,
height: 200,
listeners: {
beforeclose: function( window ) {
Ext.Msg.confirm( 'Hey', 'Are you sure you want to close?', function( answer ) {
if( answer == "yes" ) {
window.destroy();
}
} );
return false;
}
}
} ).show();
beforecloseevent should work. No?Update:
If you want to have some user interaction (i.e. confirmation question or saving data or something like that) it will be a bit tricky…
First, in the constructor of the view do something like this:
Than create handler:
Idea is – you return false immediately but have some flag and condition to go through the same logic without confirmation.