Web Interface For Lite Argus Control modules
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.9 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*!
  2. * Ext JS Library 3.3.1
  3. * Copyright(c) 2006-2010 Sencha Inc.
  4. * licensing@sencha.com
  5. * http://www.sencha.com/license
  6. */
  7. Ext.onReady(function(){
  8. // The action
  9. var action = new Ext.Action({
  10. text: 'Action 1',
  11. handler: function(){
  12. Ext.example.msg('Click','You clicked on "Action 1".');
  13. },
  14. iconCls: 'blist'
  15. });
  16. var panel = new Ext.Panel({
  17. title: 'Actions',
  18. width:600,
  19. height:300,
  20. bodyStyle: 'padding:10px;', // lazy inline style
  21. tbar: [
  22. action, { // <-- Add the action directly to a toolbar
  23. text: 'Action Menu',
  24. menu: [action] // <-- Add the action directly to a menu
  25. }
  26. ],
  27. items: [
  28. new Ext.Button(action) // <-- Add the action as a button
  29. ],
  30. renderTo: Ext.getBody()
  31. });
  32. var tb = panel.getTopToolbar();
  33. // Buttons added to the toolbar of the Panel above
  34. // to test/demo doing group operations with an action
  35. tb.add('->', {
  36. text: 'Disable',
  37. handler: function(){
  38. action.setDisabled(!action.isDisabled());
  39. this.setText(action.isDisabled() ? 'Enable' : 'Disable');
  40. }
  41. }, {
  42. text: 'Change Text',
  43. handler: function(){
  44. Ext.Msg.prompt('Enter Text', 'Enter new text for Action 1:', function(btn, text){
  45. if(btn == 'ok' && text){
  46. action.setText(text);
  47. action.setHandler(function(){
  48. Ext.example.msg('Click','You clicked on "'+text+'".');
  49. });
  50. }
  51. });
  52. }
  53. }, {
  54. text: 'Change Icon',
  55. handler: function(){
  56. action.setIconClass(action.getIconClass() == 'blist' ? 'bmenu' : 'blist');
  57. }
  58. });
  59. tb.doLayout();
  60. });