3 * Copyright(c) 2006-2009 Ext JS, LLC
5 * http://www.extjs.com/license
7 Ext.onReady(function(){
9 var action = new Ext.Action({
12 Ext.example.msg('Click','You clicked on "Action 1".');
18 var panel = new Ext.Panel({
22 bodyStyle: 'padding:10px;', // lazy inline style
25 action, { // <-- Add the action directly to a toolbar
27 menu: [action] // <-- Add the action directly to a menu
32 new Ext.Button(action) // <-- Add the action as a button
35 renderTo: Ext.getBody()
38 var tb = panel.getTopToolbar();
39 // Buttons added to the toolbar of the Panel above
40 // to test/demo doing group operations with an action
44 action.setDisabled(!action.isDisabled());
45 this.setText(action.isDisabled() ? 'Enable' : 'Disable');
50 Ext.Msg.prompt('Enter Text', 'Enter new text for Action 1:', function(btn, text){
51 if(btn == 'ok' && text){
53 action.setHandler(function(){
54 Ext.example.msg('Click','You clicked on "'+text+'".');
62 action.setIconClass(action.getIconClass() == 'blist' ? 'bmenu' : 'blist');