我正在使用ext js 4.1。我正在開發一個應用程序,它必須支持IE9,最新的FF,最新的Chrome和Safari。ExtJS 4.1:卸載事件
我需要顯示一條警告消息,當用戶想要離開時,如果有一些數據等待提交。
我做了以下使用原始的Java腳本
window.onbeforeunload=function(){
if (Ext.getStore('LocalChangesStore')){
if (Ext.getStore('LocalChangesStore').getCount() > 0) {
return 'Your changes are be lost.';
}
}
};
我想知道如果這將是可能的Ext JS的。我看到了下面的函數
app.js:
EventManager.onWindowUnload(function(){
if (Ext.getStore('LocalChangesStore')){
if (Ext.getStore('LocalChangesStore').getCount() > 0) {
return 'Your changes are be lost.';
}
}
}, this
);
,但沒有奏效。
有人可以告訴我哪個是解決此問題的最佳方法。
由於提前, 費德里科
看到http://stackoverflow.com/questions/6047862/attach-extjs-mvc-controllers-to-dom-elements-not-components – AndreKR