3 <title>The source code</title>
\r
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
7 <body onload="prettyPrint();">
\r
8 <pre class="prettyprint lang-js">Ext.onReady(function(){
10 var action = new Ext.Action({
13 Ext.example.msg('Click','You clicked on "Action 1".');
19 var panel = new Ext.Panel({
23 bodyStyle: 'padding:10px;', // lazy inline style
26 action, { // <-- Add the action directly to a toolbar
28 menu: [action] // <-- Add the action directly to a menu
33 new Ext.Button(action) // <-- Add the action as a button
36 renderTo: Ext.getBody()
39 var tb = panel.getTopToolbar();
40 // Buttons added to the toolbar of the Panel above
41 // to test/demo doing group operations with an action
45 action.setDisabled(!action.isDisabled());
46 this.setText(action.isDisabled() ? 'Enable' : 'Disable');
51 Ext.Msg.prompt('Enter Text', 'Enter new text for Action 1:', function(btn, text){
52 if(btn == 'ok' && text){
54 action.setHandler(function(){
55 Ext.example.msg('Click','You clicked on "'+text+'".');
63 action.setIconClass(action.getIconClass() == 'blist' ? 'bmenu' : 'blist');