ExtJS MVC アプリケーションでウィンドウのアンロード イベントを登録する方法を知っている人はいますか。
Ext.EventManager.on(window, 'beforeunload', function() {
alert('cross-exit tab click AND cross-exit browser click');});
上記のコードは、javascript ファイルに配置する必要があります。どのファイルに上記のコードを含めるべきかわかりません。
window.onbeforeunload = function() {
return "You have made changes, are you sure you would like to navigate away from the page?";}.bind(this);
上記のコードはその仕事をします。メインコントローラーの下に置きました。
init メソッドのすぐ内側のコントローラーに配置します。
init: function(){
Ext.EventManager.on(window, 'beforeunload', function() {
this.setAllValues(false);
});
this.control({
............
....