Bonjour,

Je réalise un desktop en Extjs 4...

J'ai un grid "Taches" et j'aimerais pouvoir ajouter des actions à cette tâche.

Pour ce faire, j'aimerais intégrer mon grid "Actions" dans un formulaire de modification.

Code de mon formulaire Tache

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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
Ext.define('MyDesktop.view.tache.EditerTache', {
    extend: 'Ext.window.Window',
    alias : 'widget.editertache',
	id:'feneditertache',
    title : 'Editer une tache',
    layout: 'fit',
    autoShow: true,
	height:400,
	width:600,
 
 
    initComponent: function() {
        this.items = [
            {
                xtype: 'form',
				id:'formedittache',
				url:'data/savetache.php',
				method:'post',
				items: [{
				xtype: 'container',
				layout:'hbox',
				items:[{
					xtype: 'container',
					flex: 1,
					border:false,
					layout: 'anchor',
					defaultType: 'textfield',
					items: [
					{
								xtype: 'textfield',
								name : 'pk_tac',
								fieldLabel: 'Identifiant',
								hidden:true
					},
					{
						xtype: 'combo',
						id: 'comboClient',
						name : 'client',
						fieldLabel:'Client',
						displayField:'username_uti',
						valueField:'pk_uti',
						store: Ext.create('MyDesktop.store.UtilisateurStore'),
						triggerAction:'all',
						mode:'local',
						anchor:'95%',
						allowBlank: false,
						blankText: 'Manque le client',
						listeners: {
									select: function(combo, record, index) {
									  alert(combo.getValue()); // Return Unitad States and no USA
									}
						}
					},
					{
						xtype: 'combo',
						id: 'comboTechnicien',
						name : 'technicien',
						fieldLabel:'Technicien',
						displayField:'username_uti',
						valueField:'pk_uti',
						store: Ext.create('MyDesktop.store.UtilisateurStore'),
						triggerAction:'all',
						mode:'local',
						anchor:'95%',
						allowBlank: false,
						blankText: 'Manque le technicien',
						listeners: {
									select: function(combo, record, index) {
									  alert(combo.getValue()); // Return Unitad States and no USA
									}
						}
					},
					{
						xtype: 'combo',
						id: 'comboInfrastructure',
						name : 'nom_inf',
						fieldLabel:'Infrastructure',
						displayField:'nom_inf',
						valueField:'pk_inf',
						store: Ext.create('MyDesktop.store.InfrastructureStore'),
						triggerAction:'all',
						mode:'local',
						anchor:'95%',
						allowBlank: false,
						blankText: 'Manque l\'infrastructure',
						listeners: {
									select: function(combo, record, index) {
									  alert(combo.getValue()); // Return Unitad States and no USA
									}
						}
					},
					{
						xtype: 'combo',
						id: 'comboStatutTache',
						name : 'nom_statac',
						fieldLabel:'Statut de tâche',
						displayField:'nom_statac',
						valueField:'pk_statac',
						store: Ext.create('MyDesktop.store.StatutTacheStore'),
						triggerAction:'all',
						mode:'local',
						anchor:'95%',
						allowBlank: false,
						blankText: 'Manque le statut de tâche',
						listeners: {
									select: function(combo, record, index) {
									  alert(combo.getValue()); // Return Unitad States and no USA
									}
						}
					}]
				},{
					xtype: 'container',
					flex: 1,
					layout: 'anchor',
					defaultType: 'textfield',
					items: [{
						fieldLabel: 'Titre',
						name: 'tit_tac',
						allowBlank: false,
						blankText: 'Manque le titre',
						anchor:'95%'
					},{
						fieldLabel: 'Description',
						name: 'des_tac',
						allowBlank: false,
						blankText: 'Manque la description',
						xtype:'textarea',
						anchor:'95%'
					}]
				}]
			},{
				xtype:'tabpanel',
				plain:true,
				activeTab: 0,
				height:235,
				defaults:{
					bodyPadding: 10
				},
				items:[{
					title:'Détails',
					defaults: {
						width: 230
					},
					defaultType: 'textfield',
 
					items: [{
						xtype: 'timefield',
						fieldLabel: 'Heure de début',
						name: 'heudeb_tac',
						minValue: '8:00am',
						maxValue: '6:00pm'
					},{
						xtype: 'timefield',
						fieldLabel: 'Heure de fin',
						name: 'heufin_tac',
						minValue: '8:00am',
						maxValue: '6:00pm'
					},{
						fieldLabel: 'Date de début',
						name: 'datdeb_tac',
						xtype: 'datefield'
					}, {
						fieldLabel: 'Date de fin',
						name: 'datfin_tac',
						xtype: 'datefield'
					}]
				},{
					title:'Catégorisations',
					defaults: {
						width: 230
					},
					defaultType: 'textfield',
 
					items: [{
						fieldLabel: 'Catégorie',
						name: 'cat_tac'
					},{
						fieldLabel: 'Urgence',
						name: 'urg_tac'
					},{
						fieldLabel: 'Priorité',
						name: 'pri_tac'
					}]
				},{
					frame: true,
					title: 'Actions',
					bodyPadding: 5,
					width: 750,
					layout: 'column',    // Specifies that the items will now be arranged in columns
 
					fieldDefaults: {
						labelAlign: 'left',
						msgTarget: 'side'
					}
 
					},{
					frame: true,
					title: 'Factures',
					bodyPadding: 5,
					width: 750,
					layout: 'column',    // Specifies that the items will now be arranged in columns
 
					fieldDefaults: {
						labelAlign: 'left',
						msgTarget: 'side'
					},
 
					items: [ 
					],
						}]
					}]
            }
        ];
 
        this.buttons = [
            {
                text: 'Enregistrer',
                action: 'save',
				handler: function ()
						{
							Ext.getCmp('formedittache').getForm().submit({
								waitMsg: 'Enregistrement...',	
								success: function () {
									 Ext.MessageBox.show({
											   title: 'Message',
											   msg: 'Les données ont été sauvegardées',
											   buttons: Ext.MessageBox.OK,
											   icon:Ext.MessageBox.MESSAGE
				                       });
									 Ext.StoreManager.lookup('TacheStore').load();
									 Ext.getCmp('feneditertache').close();
								},
								failure: function () {		
								    Ext.MessageBox.show({
									   title: 'Erreur',
									   msg: 'Complétez le formulaire svp',
									   buttons: Ext.MessageBox.OK,
									   icon:Ext.MessageBox.ERROR
				                      });
 
									}
							});
						}	
            },
            {
                text: 'Annuler',
                scope: this,
                handler: this.close
            }
        ];
 
        this.callParent(arguments);
    }
});
Code de mon grid Actions

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
 
Ext.define('MyDesktop.view.action.ActionListe', {
    extend: 'Ext.grid.Panel',
	alias : 'widget.ActionListe',
 
	title : 'Actions',
    store: 'ActionStore',
	model: 'ActionModele',
	id:'actiongrid',
	requires: [
        'Ext.grid.RowNumberer',
		'Ext.window.MessageBox',
		'MyDesktop.view.action.AjouterAction',
		'MyDesktop.view.action.EditerAction'
    ],
	selModel: Ext.create('Ext.selection.CheckboxModel'),
    initComponent: function() {
        Ext.StoreManager.lookup('ActionStore').load();
		this.columns = [
			{
				text:'Modifier',
				xtype:'actioncolumn',
				width:50,
				items: [{
					icon: 'ext/resources/images/cog_edit.png',  // Use a URL in the icon config
					tooltip: 'Modifier',
					handler: function(grid, rowIndex, colIndex) {
						var rec = grid.getStore().getAt(rowIndex);
						var FenEditerAction = Ext.widget('editeraction');
						FenEditerAction.down('form').loadRecord(rec);
					}
				}]
        	},
			{header: "Identifiant", width: 20, sortable: true, dataIndex: 'pk_act',hidden: true},
            {header: 'Tâche',  dataIndex: 'tit_tac',  flex: 1},
            {header: 'Nom', dataIndex: 'nom_act', flex: 1},
			{header: 'Description', dataIndex: 'des_act', flex: 1},
			{header: 'Date', dataIndex: 'dat_act', flex: 1},
			{header: 'Heure', dataIndex: 'heu_act', flex: 1},
        ];
 
        this.callParent(arguments);
    },
		tbar:[{
                    text:'Ajouter une action',
                    tooltip:'Ajouter une action',
                    iconCls:'add',
					xtype: 'button',
					handler : function() {
							var FenAjouterAction = Ext.widget('ajouteraction');
							FenAjouterAction.show();
					}	
				},'-',{
                    text:'Supprimer une action',
                    tooltip:'Supprimer une action',
                    iconCls:'remove',
					xtype: 'button',
					handler : function() {
												var action_grid = Ext.getCmp('actiongrid');
												var selections = action_grid.getSelectionModel().getSelection();
												var prez = [];
												Ext.each(selections, function (item) {
													  prez.push(item.data.pk_act);
												});
												var encoded_array = Ext.encode(prez);
												Ext.Ajax.request({  
													waitMsg: 'Patientez svp',
													url:  'data/deleteaction.php', 
													params: { 
														task: "DELETEACTION", 
														ids:  encoded_array
													}, 
													success: function(response){
														var result = eval(response.responseText);
														if(result==1)
														{
																Ext.MessageBox.show({
																		   title: 'Message',
																		   msg: 'Action supprimée',
																		   buttons: Ext.MessageBox.OK,
																		   icon:Ext.MessageBox.MESSAGE
																   });
																Ext.StoreManager.lookup('ActionStore').load();
														}
														else
														{
																Ext.MessageBox.alert('Attention','Impossible de supprimer.');
 
														}
													},
													failure: function(response){
														var result=response.responseText;
														Ext.MessageBox.alert('Erreur','Impossible de se connecter Ã* la base de données');      
													}
												});
					}	
                }]
});
J'aimerais insérer ce grid Actions dans la l'onglet action de mon formulaire.

Merci d'avance