3 This file is part of Ext JS 4
5 Copyright (c) 2011 Sencha Inc
7 Contact: http://www.sencha.com/contact
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
19 'Ext.window.MessageBox'
22 Ext.onReady(function(){
23 var action = Ext.create('Ext.Action', {
27 Ext.example.msg('Click', 'You clicked on "Action 1".');
31 var panel = Ext.create('Ext.panel.Panel', {
33 renderTo: document.body,
41 action, // Add the action directly to a toolbar
44 menu: [action] // Add the action directly to a menu
48 items: Ext.create('Ext.button.Button', action) // Add the action as a button
52 * Add toolbar items dynamically after creation
54 var toolbar = panel.child('#toolbar');
58 action.setDisabled(!action.isDisabled());
59 this.setText(action.isDisabled() ? 'Enable' : 'Disable');
64 Ext.Msg.prompt('Enter Text', 'Enter new text for Action 1:', function(btn, text){
65 if(btn == 'ok' && text){
67 action.setHandler(function(){
68 Ext.example.msg('Click','You clicked on "'+text+'".');
76 action.setIconCls(action.getIconCls() == 'icon-add' ? 'icon-edit' : 'icon-add');