View difference between Paste ID: 5k9x4w7Y and P4k04dBQ
SHOW: | | - or go back to the newest paste.
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: 'card',
8+
		layout    : {
9-
		animation: {
9+
			type: 'card',
10-
            type: 'slide',
10+
            animation: {
11-
            direction: 'left'
11+
				type: 'slide',
12
				direction: 'left',
13
                duration: 250
14
            }
15
        },
16-
	 items: [  
16+
17
			styleHtmlContent: 'true'
18
		},
19
	items: [  
20-
					title: 'Registeration Form',
20+
21
					docked: 'top',
22
					xtype: 'toolbar',
23
					title: 'Create Patient',
24
					items: [
25-
							align: 'centre',
25+
26
							text: 'Back',
27
							ui: 'back',
28-
								Ext.getCmp('navigatingPanels').setActiveItem(form1);
28+
							align: 'left',
29-
								console.log(Ext.getCmp('navigatingPanels'));
29+
							id: 'backButton',
30-
					
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-
					title: 'Form 0',
37+
									duration: 250
38
								});
39
								//change card
40
								Ext.getCmp('navigatingPanels').setActiveItem(0);
41-
							label: 'Form 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-
							text:'Save Data & move to form2',
46+
									direction: 'left',
47
									duration: 250
48
								});
49
							}
50
						}
51-
								Ext.getCmp('navigatingPanels').setActiveItem(form2,{ type: 'slide', direction: 'right' });
51+
52-
								console.log("hello");
52+
53
				{
54
					xtype: 'fieldset',
55
					title: 'Form 1',
56
					scrollable: 'vertical',
57
					items: [
58
						{
59
							xtype: 'textfield',
60-
});
60+
							label: 'Name',
61-
61+
62-
62+
63-
var form1 = new Ext.Panel({
63+
64-
scrollable: 'vertical',
64+
65-
	items:[
65+
							text:'Continue',
66-
		{
66+
67-
				xtype: 'fieldset',
67+
68-
				title: 'Form 1',
68+
69-
				items: [
69+
70-
					{
70+
							//change card
71-
						xtype: 'textfield',
71+
								Ext.getCmp('navigatingPanels').setActiveItem(1);
72-
						label: 'Name',
72+
								//show back button
73-
						name: 'name',
73+
								Ext.getCmp('backButton').show();
74-
					},
74+
75-
					{
75+
76-
						xtype:'button',
76+
77-
						text:'Save Data & move to form2',
77+
78-
						ui: 'confirm',
78+
79-
						//TODO add some action: to store data
79+
80-
						//save data & move to form2
80+
					title: 'Form 2',
81-
						handler: function() {
81+
					scrollable: 'vertical',
82-
							Ext.getCmp('navigatingPanels').setActiveItem(form2,{ type: 'slide', direction: 'right' });
82+
83-
							console.log("Form1");
83+
84
							xtype: 'textareafield',
85-
					}
85+
							label: 'Message',
86-
				]
86+
							name: 'message'
87-
		}
87+
88-
	]
88+
89-
});
89+
90-
var form2 =new Ext.Panel({
90+
							text:'Submit Data',
91-
	scrollable: 'vertical',
91+
92-
	items:[
92+
93-
		{
93+
							//action: 'Submit Data'
94-
				xtype: 'fieldset',
94+
95-
				title: 'Form 2',
95+
					]	
96-
				items: [
96+
97-
					{
97+
98-
						xtype: 'textareafield',
98+
99-
						label: 'Message',
99+
100-
						name: 'message'
100+