Advertisement
Guest User

Untitled

a guest
Oct 1st, 2013
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 KB | None | 0 0
  1. //---------------------------------------------------------------------
  2. // sa.TEST application
  3. //---------------------------------------------------------------------
  4. // Copyright (C) 2007-2013 The NOC Project
  5. // See LICENSE for details
  6. //---------------------------------------------------------------------
  7. console.debug("Defining NOC.sa.TEST.Application");
  8.  
  9. Ext.define("NOC.sa.TEST.Application", {
  10. extend: "NOC.core.Application",
  11. requires: ["Ext.ux.form.UCField"],
  12. layout: { type: 'vbox', align: 'stretch' },
  13. border: 0,
  14. items : [{
  15. xtype: "container",
  16. items: [{
  17. xtype: 'form',
  18. border: 0,
  19. url: "/sa/TEST/",
  20. padding: 0,
  21. bodyPadding: 0,
  22. waitMsgTarget : true,
  23. defaults: {
  24. enableKeyEvents: true,
  25. listeners: {
  26. specialkey: function(field, key) {
  27. if (field.xtype != "textfield")
  28. return;
  29. var get_button = function(scope, name) {
  30. return scope.ownerCt.down("toolbar").getComponent(name);
  31. }
  32. switch(key.getKey()) {
  33. case Ext.EventObject.ENTER:
  34. var b = get_button(field, "summ");
  35. key.stopEvent();
  36. b.handler.call(b);
  37. break;
  38. }
  39. }
  40. },
  41. xtype: "textfield",
  42. msgTarget : "side",
  43. size: 30
  44. },
  45. items: [
  46. {
  47. xtype: 'textfield',
  48. name: 'a',
  49. },
  50. {
  51. xtype: 'textfield',
  52. name: 'b',
  53. },
  54. {
  55. xtype: 'button',
  56. text: 'summ',
  57. handler : function() {
  58. var form = this.up("form").getForm();
  59. form.submit({
  60. method: "GET",
  61. submitEmptyText : false,
  62. params : { __format: "ext" },
  63. success: function(form, action) {
  64. form.owner.up("panel").down("textareafield").setValue(action.result.summ);
  65. }
  66. });
  67. }
  68. },
  69. {
  70. xtype: "textarea",
  71. name: 'summ',
  72. flex: 1
  73. }
  74. ]
  75. }]
  76. }]
  77. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement