Salut,
J'arrive pas a comprendre le mode de fonctionnement du framework ExtJS.
J'ai afficher ma grid sans aucun problème, mais la modification ne fonctionne pas :
code :
- controller/article.js ()
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 ..... updateArticle: function(button){ var win = button.up('window'), form = win.down('form'), record = form.getRecord(), values = form.getValues(); console.log(values); var nouveau = false; var store = this.getStore('article.Articles'); if (values.id > 0){ record.set(values); } else{ record = Ext.create('ExtApp.model.article.Article'); record.set(values); store.add(record); nouveau = true; } win.close(); store.sync(); if (nouveau){ store.load(); } }, ......
- Store :
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 Ext.define('ExtApp.store.article.Articles', { extend: 'Ext.data.Store', requires: ['Ext.data.Store', 'ExtApp.model.article.Article'], model: 'ExtApp.model.article.Article', pageSize: 20, //autoLoad: {start: 0, limit: 20}, remoteFilter: true, proxy: { type: 'ajax', api: { create: 'php/article/addArticle.php', read: 'php/article/readArticles.php', // ca marche : la lecture de la table update: 'php/article/updateArticle.php', // updateArticle.php n'est jamais executé!!! :oops: destroy:'php/article/deleteArticle.php' }, reader: { type: 'json' ,root: 'data' ,successProperty: 'success' ,totalProperty: 'total' }, writer: { type: 'json', writeAllFields: true, root: 'data', encode: true } } });
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 - Model Ext.define('ExtApp.model.article.Article', { extend: 'Ext.data.Model' ,requires: ['Ext.data.Model'] ,fields: [ { name: 'id' ,type: 'int' } ,{ name: 'cdart' ,type: 'string' } ,{ name: 'design1' ,type: 'string' } ,{ name: 'ref' ,type: 'string' } ,{ name: 'stki1' ,type: 'float' } ,{ name: 'qtte1' ,type: 'number' } ,{ name: 'dpaht' ,type: 'number' } ] });
- vue : view/article/Edit.js
Aucun problème pour l'affichage :
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 Ext.define('ExtApp.view.article.Edit',{ extend : 'Ext.window.Window', alias: 'widget.articleedit', title: 'Modifier article', layout: 'fit', autoShow: true, width:600, initComponent: function(){ this.items = [ { xtype: 'form', padding: '5 5 0 5', border: false, style: 'background-color: #fff;', fieldDefaults: { anchor: '100%', labelAlign: 'left', allowBlank: false, combineErrors: true, msgTarget: 'side' }, items: [ { xtype: 'textfield', name : 'id', fieldLabel: 'id', hidden:true }, { xtype: 'textfield', //width: 200, name: 'cdart', fieldLabel: 'Code' }, { xtype: 'textfield', name: 'design1', width: 540, fieldLabel: 'Designation' }, { xtype: 'textfield', name: 'ref', fieldLabel: 'Reference' }] } ]; this.dockedItems = [{ xtype: 'toolbar', dock: 'bottom', id:'buttons', ui: 'footer', items: ['->', { iconCls: 'icon-save', text: 'Salvar', action: 'save' },{ iconCls: 'icon-reset', text: 'Cancelar', scope: this, handler: this.close }] }]; this.callParent(arguments); } });
La modification ne s’exécute pas ...
Partager