Ext.Msg.alert要注意的问题
2008-05-11 22:49
155 查看
我们先看看API中关于Ext.Message的中的描述:
Note that theMessageBox is asynchronous. Unlike a regular JavaScript
这里要我们注意Ext的MessageBox是异步,和JS的alert是不同,JS的alert执行的时候会挂起代码,不继续执行,而Ext的MessageBox是会继续执行的。所以有时候我们会看到MessageBox会闪一下就过去了。如何解决这个问题呢?其实很简单。
我们看看MessageBox中alert的定义:
alert(
注意第三个参数没有?是一个函数。我们看看函数的说明:
· fn : Function
(optional) Thecallback function invoked after the message box is closed
是窗口关闭后执行的回调函数。
呵呵,解决办法出来了,就是将后续的执行动作放到这个函数里,等窗口关闭后继续执行。
Note that theMessageBox is asynchronous. Unlike a regular JavaScript
alert(whichwill halt browser execution), showing a MessageBox will not cause the code tostop. For this reason, if you have code that should only run aftersome user feedback from the MessageBox, you must use a callback function (seethe
functionparameter for show for more details).
这里要我们注意Ext的MessageBox是异步,和JS的alert是不同,JS的alert执行的时候会挂起代码,不继续执行,而Ext的MessageBox是会继续执行的。所以有时候我们会看到MessageBox会闪一下就过去了。如何解决这个问题呢?其实很简单。
我们看看MessageBox中alert的定义:
alert(
Stringtitle,
String msg, [
Functionfn], [
Object scope] ) : Ext.MessageBox
注意第三个参数没有?是一个函数。我们看看函数的说明:
· fn : Function
(optional) Thecallback function invoked after the message box is closed
是窗口关闭后执行的回调函数。
呵呵,解决办法出来了,就是将后续的执行动作放到这个函数里,等窗口关闭后继续执行。
相关文章推荐
- Ext.Msg.alert要注意的问题
- Ext.Msg.alert要注意的问题
- Ext.Msg.alert要注意的问题
- Ext.Msg.alert要注意的问题
- [Sencha ExtJS & Touch] 表格(Ext.grid.Grid) 和 表格视图选项(Ext.grid.plugin.ViewOptions) 使用的时候要注意的问题
- 关于Ext.PagingToolbar不显示displayMsg,emptyMsg问题
- Extjs4 消息框去掉关闭按钮(类似Ext.Msg.alert)
- Ext.TreePanel的问题注意
- 【编程技巧】alert vs Ext.Msg.alert
- Ext.Msg.alert添加确定按钮
- Ext.Msg.alert() 在点确定后执行其他动作
- Ext.ux.maximgb.tg.GridPanel需注意的一个问题
- Ext.extend 注意config中定义的数组 导致对象共用的问题
- alert(参数),参数为字符串类型时需要注意的问题。
- Qt串行通信库 QextSerialPort需要注意的问题 便签
- ExtJS初学笔记---Ext.Msg.alert无效果
- ext 页面注意几个问题
- C++Builder中使用iwnativxml中的TNativeXML注意的问题
- ajax和setTimeout一起用注意问题