我正在使用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