Last section extjs (1)
The last section briefly introduces extjs, and then learns the message class.
The following methods are provided:
1.
Alert
Alert(
String title,
String msg,[
Function fn], [
Object scope]):
The following two parameters are optional:
Ext. MessageBox. Alert ('status', 'changes saved successfully. ', showresult );
Function showresult (BTN ){
Ext. MSG ('button click', BTN );
};
2.
Confirm
Confirm(
String title,
String msg,[
Function fn], [
Object scope]):
The usage here is similar to that of alert.
Ext. MessageBox. Confirm ('Confirm', 'Are you sure you want to do that? ', Showresult );
Function showresult (BTN ){
Ext. MSG ('button click', BTN );
};
3.
Prompt
Prompt(
String title,
String msg,[
Function fn], [
Object scope], [
Boolean/Number multiline]): Ext. MessageBox
Ext. MessageBox. Prompt ('name', 'Please enter your name: ', showresulttext );
Function showresulttext (BTN, text ){
Ext. MSG ('button click', text );
};
The first parameter is the button parameter, and the second parameter is the passed value, that is, the value obtained after the input.
4.
Multi-line prompt
Ext. MessageBox. Show ({
Title: 'address ',
MSG: 'Please enter your address :',
Width: 300,
Buttons: Ext. MessageBox. okcancel,
Multiline: True,
FN: showresulttext,
Animel: 'mb3 ',
Icon: Ext. MessageBox. Question
});
Function showresulttext (BTN, text ){
Ext. MSG ('button click', text );
};
Title is the title displayed, MSG is the actual prompt message, width is the width of the input box, button is the button displayed in the message box, multiline is multi-line input, FN processing function, icon
5.
Yes/No/cancel
Ext. MessageBox. Show ({
Title: 'save changes? ',
MSG: 'You are closing a tab that has unsaved changes. <br/> wocould you like to save your changes? ',
Buttons: Ext. MessageBox. yesnocancel,
FN: showresult,
Animel: 'mb4 ',
Icon: Ext. MessageBox. Question
});
6.
Progress Dialog
Ext. MessageBox. Show ({
Title: 'Please wait ',
MSG: 'loading items ...',
Progresstext: 'initializing ...',
Width: 300,
Progress: True,
Closable: false,
Animel: 'mb6'
});
// This hideous block creates the bogus progress
VaR F = function (v ){
Return function (){
If (V = 12 ){
Ext. MessageBox. Hide ();
Ext. example. MSG ('done', 'Your fake items were loaded! ');
} Else {
VaR I = V/11;
Ext. MessageBox. updateprogress (I, math. Round (100 * I) + '% completed ');
}
};
};
For (VAR I = 1; I <13; I ++ ){
SetTimeout (f (I), I * 500 );
}
The following part uses timing to refresh the progress bar and display the progress bar.
7. Wait Dialog
Ext. MessageBox. Show ({
MSG: 'saving your data, please wait ...',
Progresstext: 'saving ...',
Width: 300,
Wait: True,
Waitconfig: {interval: 200 },
Icon: 'ext-MB-download', // custom class in msg-box.html
Animel: 'mb7'
});
SetTimeout (function (){
// This simulates a long-running operation like a database save or xhr call.
// In real code, this wocould be in a callback function.
Ext. MessageBox. Hide ();
Ext. example. MSG ('done', 'Your fake data was saved! ');
},8000 );
This is probably the warning. For more information, refer to the official documentation.