2 * Ext JS Library 2.2.1
\r
3 * Copyright(c) 2006-2009, Ext JS, LLC.
\r
4 * licensing@extjs.com
\r
6 * http://extjs.com/license
\r
9 Ext.onReady(function(){
\r
10 Ext.get('mb1').on('click', function(e){
\r
11 Ext.MessageBox.confirm('Confirm', 'Are you sure you want to do that?', showResult);
\r
14 Ext.get('mb2').on('click', function(e){
\r
15 Ext.MessageBox.prompt('Name', 'Please enter your name:', showResultText);
\r
18 Ext.get('mb3').on('click', function(e){
\r
19 Ext.MessageBox.show({
\r
21 msg: 'Please enter your address:',
\r
23 buttons: Ext.MessageBox.OKCANCEL,
\r
30 Ext.get('mb4').on('click', function(e){
\r
31 Ext.MessageBox.show({
\r
32 title:'Save Changes?',
\r
33 msg: 'You are closing a tab that has unsaved changes. <br />Would you like to save your changes?',
\r
34 buttons: Ext.MessageBox.YESNOCANCEL,
\r
37 icon: Ext.MessageBox.QUESTION
\r
41 Ext.get('mb6').on('click', function(){
\r
42 Ext.MessageBox.show({
\r
43 title: 'Please wait',
\r
44 msg: 'Loading items...',
\r
45 progressText: 'Initializing...',
\r
52 // this hideous block creates the bogus progress
\r
53 var f = function(v){
\r
56 Ext.MessageBox.hide();
\r
57 Ext.example.msg('Done', 'Your fake items were loaded!');
\r
60 Ext.MessageBox.updateProgress(i, Math.round(100*i)+'% completed');
\r
64 for(var i = 1; i < 13; i++){
\r
65 setTimeout(f(i), i*500);
\r
69 Ext.get('mb7').on('click', function(){
\r
70 Ext.MessageBox.show({
\r
71 msg: 'Saving your data, please wait...',
\r
72 progressText: 'Saving...',
\r
75 waitConfig: {interval:200},
\r
76 icon:'ext-mb-download', //custom class in msg-box.html
\r
79 setTimeout(function(){
\r
80 //This simulates a long-running operation like a database save or XHR call.
\r
81 //In real code, this would be in a callback function.
\r
82 Ext.MessageBox.hide();
\r
83 Ext.example.msg('Done', 'Your fake data was saved!');
\r
87 Ext.get('mb8').on('click', function(){
\r
88 Ext.MessageBox.alert('Status', 'Changes saved successfully.', showResult);
\r
91 //Add these values dynamically so they aren't hard-coded in the html
\r
92 Ext.fly('info').dom.value = Ext.MessageBox.INFO;
\r
93 Ext.fly('question').dom.value = Ext.MessageBox.QUESTION;
\r
94 Ext.fly('warning').dom.value = Ext.MessageBox.WARNING;
\r
95 Ext.fly('error').dom.value = Ext.MessageBox.ERROR;
\r
97 Ext.get('mb9').on('click', function(){
\r
98 Ext.MessageBox.show({
\r
99 title: 'Icon Support',
\r
100 msg: 'Here is a message with an icon!',
\r
101 buttons: Ext.MessageBox.OK,
\r
104 icon: Ext.get('icons').dom.value
\r
108 function showResult(btn){
\r
109 Ext.example.msg('Button Click', 'You clicked the {0} button', btn);
\r
112 function showResultText(btn, text){
\r
113 Ext.example.msg('Button Click', 'You clicked the {0} button and entered the text "{1}".', btn, text);
\r