Bonsoir,

J'ai eu quelques indications pour ouvrir un sous Tabpanel en cliquant sur un tab d'un 1er tabpanel.

Je n'arrive pas à l'adapter pour un item d eliste. Peut-on appeler une variable ensuite ?

Merci

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
Ext.define('push.view.Main', {
    extend: 'Ext.navigation.View',
 
    config: {
        ui: 'light',
        autoDestroy: false
 
    },
 
    constructor : function(){
        this.callParent(arguments);
 
        this.firstTabPanel = Ext.create('Ext.tab.Panel',{
            title: 'MyTabPanel1',
            layout: {
                animation: 'fade',
                type: 'card'
            },
            items: [
                {
                    xtype: 'container',
                    title: 'Tab 1',
                    iconCls: 'info',
                    html : 'TAB 1'
                },
                {
                    xtype: 'container',
                    title: 'Tab 2',
                    iconCls: 'info',
                    html : 'TAB 2'
                },
                {
                    xtype: 'list',
                    title: 'Tab 3',
                    iconCls: 'info',
                    html : 'TAB 3',
                    store: {
                                  fields: ['name'],
                                  data: [
                                    {name: '1st item'},
                                    {name: '2nd item'}                                
                                  ]
                                },
                    onItemDisclosure: true,
 
                    itemTpl: '{name}',
 
                    listeners: {
 
                       itemtap: function (view, index, target, record, evt) {
 
 
                            if(index==0){
// how to push the secondtabpanel when clickning on index 0 ? Variable ?
                                var x = 1;
                            }
                            else if(index==1){
                                var x = 2;
                            }    
 
                        }
                    }
 
 
                }
            ],
            tabBar: {
                docked: 'bottom'
            }
        });
 
        this.secondTabPanel = Ext.create('Ext.tab.Panel',{
            title: 'MyTabPanel2',
            items: [
                {
                    xtype: 'container',
                    title: 'Tab 4',
                    iconCls: 'info',
                    html : 'TAB 4'
                },
                {
                    xtype: 'container',
                    title: 'Tab 5',
                    iconCls: 'info',
                    html : 'TAB 5'
                },
                {
                    xtype: 'container',
                    title: 'Tab 6',
                    iconCls: 'info',
                    html : 'TAB 6'
                }
            ],
            tabBar: {
                docked: 'bottom'
            }
        });
 
        this.thirdTabPanel = Ext.create('Ext.tab.Panel',{
            title: 'MyTabPanel3',
            items: [
                {
                    xtype: 'container',
                    title: 'Tab 7',
                    iconCls: 'info',
                    html : 'TAB 7'
                },
                {
                    xtype: 'container',
                    title: 'Tab 8',
                    iconCls: 'info',
                    html : 'TAB 8'
                },
                {
                    xtype: 'container',
                    title: 'Tab 9',
                    iconCls: 'info',
                    html : 'TAB 9'
                }
            ],
            tabBar: {
                docked: 'bottom'
            }
        });
 
        this.firstTabPanel.on('activeitemchange', this.tabPanel1ActiveItemChange, this);
 
        //show first tab panel
        this.push(this.firstTabPanel);
    },
 
    tabPanel1ActiveItemChange : function(tabpanel, newtab){
        //how to get the variable from itemtap ?
        if(x = 1){
            this.push(this.secondTabPanel);
        }
        else if(x = 2){
      this.push(this.thirdTabPanel);
                            }   
 
    }
});