chughgaurav

navigatingPanels.js

Apr 17th, 2012
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Ext.define('MyApp.view.navigatingPanels',{
  2. extend: 'Ext.Panel',
  3. id: 'navigatingPanels',
  4. xtype: 'navigatingPanels',
  5. config:{
  6. iconCls:'user',
  7. title: 'Navigating Panels',
  8. layout : {
  9. type: 'card',
  10. animation: {
  11. type: 'slide',
  12. direction: 'left',
  13. duration: 250
  14. }
  15. },
  16. defaults:{
  17. styleHtmlContent: 'true'
  18. },
  19. items: [
  20. {
  21. docked: 'top',
  22. xtype: 'toolbar',
  23. title: 'Create Patient',
  24. items: [
  25. {
  26. text: 'Back',
  27. ui: 'back',
  28. align: 'left',
  29. id: 'backButton',
  30. hidden: true,
  31. //back button to take the user back from form2 to form1
  32. handler: function() {
  33. //change the slide direction to right
  34. Ext.getCmp('navigatingPanels').getLayout().setAnimation({
  35. type: 'slide',
  36. direction: 'right',
  37. duration: 250
  38. });
  39. //change card
  40. Ext.getCmp('navigatingPanels').setActiveItem(0);
  41. //hide back button
  42. Ext.getCmp('backButton').hide();
  43. //change the slide direction to left
  44. Ext.getCmp('navigatingPanels').getLayout().setAnimation({
  45. type: 'slide',
  46. direction: 'left',
  47. duration: 250
  48. });
  49. }
  50. }
  51. ]
  52. },
  53. {
  54. xtype: 'fieldset',
  55. title: 'Form 1',
  56. scrollable: 'vertical',
  57. items: [
  58. {
  59. xtype: 'textfield',
  60. label: 'Name',
  61. name: 'name',
  62. },
  63. {
  64. xtype:'button',
  65. text:'Continue',
  66. ui: 'confirm',
  67. //TODO add some action: to store data
  68. //save data & move to form2
  69. handler: function() {
  70. //change card
  71. Ext.getCmp('navigatingPanels').setActiveItem(1);
  72. //show back button
  73. Ext.getCmp('backButton').show();
  74. }
  75. }
  76. ]
  77. },
  78. {
  79. xtype: 'fieldset',
  80. title: 'Form 2',
  81. scrollable: 'vertical',
  82. items: [
  83. {
  84. xtype: 'textareafield',
  85. label: 'Message',
  86. name: 'message'
  87. },
  88. {
  89. xtype:'button',
  90. text:'Submit Data',
  91. ui: 'confirm',
  92. //TODO add some action: to store data
  93. //action: 'Submit Data'
  94. }
  95. ]
  96. }
  97. ]
  98. }
  99.  
  100. });
Advertisement
Add Comment
Please, Sign In to add comment