Last change
on this file since 619 was
619,
checked in by ramonb, 15 years ago
|
lib/:
- added new AJAX dependancies: ExtJS, pChart, Lightbox2
|
File size:
1.9 KB
|
Line | |
---|
1 | /* |
---|
2 | * Ext JS Library 2.2.1 |
---|
3 | * Copyright(c) 2006-2009, Ext JS, LLC. |
---|
4 | * licensing@extjs.com |
---|
5 | * |
---|
6 | * http://extjs.com/license |
---|
7 | */ |
---|
8 | |
---|
9 | Ext.onReady(function(){ |
---|
10 | // The action |
---|
11 | var action = new Ext.Action({ |
---|
12 | text: 'Action 1', |
---|
13 | handler: function(){ |
---|
14 | Ext.example.msg('Click','You clicked on "Action 1".'); |
---|
15 | }, |
---|
16 | iconCls: 'blist' |
---|
17 | }); |
---|
18 | |
---|
19 | |
---|
20 | var panel = new Ext.Panel({ |
---|
21 | title: 'Actions', |
---|
22 | width:600, |
---|
23 | height:300, |
---|
24 | bodyStyle: 'padding:10px;', // lazy inline style |
---|
25 | |
---|
26 | tbar: [ |
---|
27 | action, { // <-- Add the action directly to a toolbar |
---|
28 | text: 'Action Menu', |
---|
29 | menu: [action] // <-- Add the action directly to a menu |
---|
30 | } |
---|
31 | ], |
---|
32 | |
---|
33 | items: [ |
---|
34 | new Ext.Button(action) // <-- Add the action as a button |
---|
35 | ], |
---|
36 | |
---|
37 | renderTo: Ext.getBody() |
---|
38 | }); |
---|
39 | |
---|
40 | |
---|
41 | // Buttons added to the toolbar of the Panel above |
---|
42 | // to test/demo doing group operations with an action |
---|
43 | panel.getTopToolbar().add('->', { |
---|
44 | text: 'Disable', |
---|
45 | handler: function(){ |
---|
46 | action.setDisabled(!action.isDisabled()); |
---|
47 | this.setText(action.isDisabled() ? 'Enable' : 'Disable'); |
---|
48 | } |
---|
49 | }, { |
---|
50 | text: 'Change Text', |
---|
51 | handler: function(){ |
---|
52 | Ext.Msg.prompt('Enter Text', 'Enter new text for Action 1:', function(btn, text){ |
---|
53 | if(btn == 'ok' && text){ |
---|
54 | action.setText(text); |
---|
55 | action.setHandler(function(){ |
---|
56 | Ext.example.msg('Click','You clicked on "'+text+'".'); |
---|
57 | }); |
---|
58 | } |
---|
59 | }); |
---|
60 | } |
---|
61 | }, { |
---|
62 | text: 'Change Icon', |
---|
63 | handler: function(){ |
---|
64 | action.setIconClass(action.getIconClass() == 'blist' ? 'bmenu' : 'blist'); |
---|
65 | } |
---|
66 | }); |
---|
67 | }); |
---|
Note: See
TracBrowser
for help on using the repository browser.