Notes for Ext. Msg. alert

Source: Internet
Author: User

Let's take a look at the description in the API about Ext. Message:

Note that theMessageBox is asynchronous. Unlike a regular JavaScriptalert(Whichwill halt browser execution), showing a MessageBox will not cause the code tostop. For this reason, if you have code that shocould only runAfterSome user feedback from the MessageBox, you must use a callback function (seethefunctionParameter for show for more details ).

 

Here, we should note that Ext's MessageBox is asynchronous, which is different from JS's alert. When JavaScript's alert is executed, the code will be suspended and the code will not continue to be executed, the MessageBox of Ext will continue to be executed. So sometimes we will see MessageBox will flash and pass. How can this problem be solved? It is actually very simple.

Let's take a look at the definition of alert in MessageBox:

Alert(Stringtitle,String msg,[Functionfn],[Object scope]): Ext. MessageBox

 

Note that the third parameter does not exist? Is a function. Let's look at the description of the function:

 

·Fn: Function

(Optional) Thecallback function invoked after the message box is closed

 

Is the callback function executed after the window is closed.

The solution is to put the subsequent execution actions in this function and continue execution after the window is closed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.