Ext 입문 코드 실전-기초 편
지식 1. 정보 알림 상자 구성 요소
1.Ext.MessageBox.alert()
alert(String title, String msg, Function fn, Object scope)를 사용합니다.
네 개의 매개 변수: 앞의 두 개의 필수, 뒤의 두 개의 창을 닫은 후 터치 함수
코드 실전:
Ext.onReady(
function TestMessageBox(){
Ext.MessageBox.alert(" "," ",function(e){
document.write(" ");
if(e == 'ok'){
document.write(" ");
}else if(e == 'cancel'){
document.write(" ");
}
});
}
);
2. Ext.MessageBox.confirm()
사용법은 alert()와 동일
실전 코드
Ext.onReady(
function TestMessageBox(){
Ext.MessageBox.confirm(" "," ",function(e){
if(e == 'yes') {
document.write(" ");
} else if(e == 'no') {
document.write(" ");
}
});
}
);
3.Ext.MessageBox.prompt()
prompt(String title, String msg, Function fn, Object scope, Boolean/Number multiline)를 사용합니다.
멀티라인이 여러 줄로 표시되는지 여부
실전 코드
Ext.onReady(
function TestMessageBox() {
Ext.MessageBox.prompt(" "," ",function(e,text) {
if(e == "ok") {
document.write(text);
}
},null,true);
}
);
4. Ext.MessageBox.show()
API 설명:
animEl String/Element
buttons Object/Boolean
closable Boolean false, , true。
cls String CSS
defaultTextHeight Number
fn Function
icon String
maxWidth Number ( 600)
minWidth Number ( 100)
modal Boolean
msg String
multiline Boolean true,
progress Boolean true,
progressText String
prompt Boolean true,
proxyDrag Boolean true,
title String
value String
wait Boolean true, progress
waitConfig Object , progress
width Number
코드 실전:
Ext.onReady(
function TestMessageBox() {
Ext.MessageBox.show({
title:" ",
msg:" ",
buttons:Ext.MessageBox.OKCANCEL,
icon:Ext.MessageBox.INFO,
prompt:true,
multiline:true,
width:400,
defaultTextHeight :150
});
}
);
진행률 표시줄
Ext.onReady(
function TestMessageBox() {
Ext.MessageBox.show({
title:" ",
msg:"5 ",
progress:true,
width:500,
wait:true,
waitConfig:{
interval:500,
duration:5000,
fn:function() {
Ext.MessageBox.hide();
}
}
});
}
);