Mat Demo
Blah blah
by spydmobile
HTML
<script src="http://dev.sencha.com/deploy/ext-3.4.0/adapter/ext/ext-base.js"></script>
<link rel="stylesheet" href="http://dev.sencha.com/deploy/ext-3.4.0/resources/css/ext-all.css">
<script src="http://dev.sencha.com/deploy/ext-3.4.0/ext-all.js"></script>
<h1>MessageBox Dialogs</h1>
<p>The example shows how to use the MessageBox class. Some of the buttons have animations, some are normal.</p>
<p>The js is not minified so it is readable. See <a href="msg-box.js">msg-box.js</a>.</p>
<p>
<b>Confirm</b><br />
Standard Yes/No dialog.
<button id="mb1">Show</button>
</p>
<p>
<b>Prompt</b><br />
Standard prompt dialog.
<button id="mb2">Show</button>
</p>
<p>
<b>Multi-line Prompt</b><br />
A multi-line prompt dialog.
<button id="mb3">Show</button>
</p>
<p>
<b>Yes/No/Cancel</b><br />
Standard Yes/No/Cancel dialog.
<button id="mb4">Show</button>
</p>
<p>
<b>Progress Dialog</b><br />
Dialog with measured progress bar.
<button id="mb6">Show</button>
</p>
<p>
<b>Wait Dialog</b><br />
Dialog with indefinite progress bar and custom icon (will close after 8 sec).
<button id="mb7">Show</button>
</p>
<p>
<b>Alert</b><br />
Standard alert message dialog.
<button id="mb8">Show</button>
</p>
<p>
<b>Icons</b><br />
Standard alert with optional icon.
<select id="icons">
<option id="error" selected="selected">Error</option>
<option id="info">Informational</option>
<option id="question">Question</option>
<option id="warning">Warning</option>
</select>
<button id="mb9">Show</button>
</p>
JavaScript
/*!
* Ext JS Library 3.4.0
* Copyright(c) 2006-2011 Sencha Inc.
* [email protected]
* http://www.sencha.com/license
*/
Ext.onReady(function(){
Ext.get('mb1').on('click', function(e){
Ext.MessageBox.confirm('Confirm', 'Are you sure you want to do that?', showResult);
});
Ext.get('mb2').on('click', function(e){
Ext.MessageBox.prompt('Name', 'Please enter your name:', showResultText);
});
Ext.get('mb3').on('click', function(e){
Ext.MessageBox.show({
title: 'Address',
msg: 'Please enter your address:',
width:300,
buttons: Ext.MessageBox.OKCANCEL,
multiline: true,
fn: showResultText,
animEl: 'mb3'
});
});
Ext.get('mb4').on('click', function(e){
Ext.MessageBox.show({
title:'Save Changes?',
msg: 'You are closing a tab that has unsaved changes. <br />Would you like to save your changes?',
buttons: Ext.MessageBox.YESNOCANCEL,
fn: showResult,
animEl: 'mb4',
icon: Ext.MessageBox.QUESTION
});
});
Ext.get('mb6').on('click', function(){
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);
}
});
...