2 'Ext.window.MessageBox',
6 Ext.onReady(function(){
7 Ext.get('mb1').on('click', function(e){
8 Ext.MessageBox.confirm('Confirm', 'Are you sure you want to do that?', showResult);
11 Ext.get('mb2').on('click', function(e){
12 Ext.MessageBox.prompt('Name', 'Please enter your name:', showResultText);
15 Ext.get('mb3').on('click', function(e){
18 msg: 'Please enter your address:',
20 buttons: Ext.MessageBox.OKCANCEL,
27 Ext.get('mb4').on('click', function(e){
29 title:'Save Changes?',
30 msg: 'You are closing a tab that has unsaved changes. <br />Would you like to save your changes?',
31 buttons: Ext.MessageBox.YESNOCANCEL,
34 icon: Ext.MessageBox.QUESTION
38 Ext.get('mb6').on('click', function(){
41 msg: 'Loading items...',
42 progressText: 'Initializing...',
49 // this hideous block creates the bogus progress
53 Ext.MessageBox.hide();
54 Ext.example.msg('Done', 'Your fake items were loaded!');
57 Ext.MessageBox.updateProgress(i, Math.round(100*i)+'% completed');
61 for(var i = 1; i < 13; i++){
62 setTimeout(f(i), i*500);
66 Ext.get('mb7').on('click', function(){
68 msg: 'Saving your data, please wait...',
69 progressText: 'Saving...',
72 waitConfig: {interval:200},
73 icon:'ext-mb-download', //custom class in msg-box.html
76 setTimeout(function(){
77 //This simulates a long-running operation like a database save or XHR call.
78 //In real code, this would be in a callback function.
79 Ext.MessageBox.hide();
80 Ext.example.msg('Done', 'Your fake data was saved!');
84 Ext.get('mb8').on('click', function(){
85 Ext.MessageBox.alert('Status', 'Changes saved successfully.', showResult);
88 //Add these values dynamically so they aren't hard-coded in the html
89 Ext.fly('info').dom.value = Ext.MessageBox.INFO;
90 Ext.fly('question').dom.value = Ext.MessageBox.QUESTION;
91 Ext.fly('warning').dom.value = Ext.MessageBox.WARNING;
92 Ext.fly('error').dom.value = Ext.MessageBox.ERROR;
94 Ext.get('mb9').on('click', function(){
96 title: 'Icon Support',
97 msg: 'Here is a message with an icon!',
98 buttons: Ext.MessageBox.OK,
101 icon: Ext.get('icons').dom.value
105 function showResult(btn){
106 Ext.example.msg('Button Click', 'You clicked the {0} button', btn);
109 function showResultText(btn, text){
110 Ext.example.msg('Button Click', 'You clicked the {0} button and entered the text "{1}".', btn, text);