IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Ext JS / Sencha Discussion :

Modification non effectuée


Sujet :

Ext JS / Sencha

  1. #1
    Membre du Club
    Profil pro
    Développeur informatique
    Inscrit en
    Juin 2007
    Messages
    144
    Détails du profil
    Informations personnelles :
    Localisation : Maroc

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2007
    Messages : 144
    Points : 50
    Points
    50
    Par défaut Modification non effectuée
    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 :

    Nom : Capture d’écran 2015-07-07 à 08.10.03.png
Affichages : 149
Taille : 27,2 Ko

    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

    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);
        }
    });
    Aucun problème pour l'affichage :

    Nom : Capture d’écran 2015-07-07 à 07.52.36.png
Affichages : 141
Taille : 210,2 Ko

    La modification ne s’exécute pas ...

    Nom : Capture d’écran 2015-07-07 à 07.53.11.png
Affichages : 126
Taille : 145,1 Ko

    Nom : Capture d’écran 2015-07-07 à 07.53.30.png
Affichages : 134
Taille : 147,5 Ko

  2. #2
    Membre régulier
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Novembre 2006
    Messages
    46
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Novembre 2006
    Messages : 46
    Points : 82
    Points
    82
    Par défaut
    Pourquoi dis-tu que la modification ne s'effectue pas alors que l'on voit le champ modifié après la saisie ?

  3. #3
    Membre du Club
    Profil pro
    Développeur informatique
    Inscrit en
    Juin 2007
    Messages
    144
    Détails du profil
    Informations personnelles :
    Localisation : Maroc

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2007
    Messages : 144
    Points : 50
    Points
    50
    Par défaut
    Salut,
    tu vois le petit triangle rouge sur le champs modifié, ça veut dire que le champs n'est pas à jour.

    En plus; en vérifiant sur PhpMyAdmin, le le champs n'est pas à jour.

    Merci pour la réponse:

  4. #4
    Membre éclairé
    Avatar de abraxis
    Homme Profil pro
    Développeur Web
    Inscrit en
    Mai 2007
    Messages
    439
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2007
    Messages : 439
    Points : 658
    Points
    658
    Par défaut
    Bonjour,

    est bien le store de ton grid ?

    Que retourne un
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    console.log(store.getUpdatedRecords());
    Il n'y a pas d'appel dans ta console pour l'update, cherche de se côté la pour savoir pourquoi le sync n'est pas effectué.
    Une erreur sur le store à synchroniser ?
    # apt-get install freedom

  5. #5
    Membre du Club
    Profil pro
    Développeur informatique
    Inscrit en
    Juin 2007
    Messages
    144
    Détails du profil
    Informations personnelles :
    Localisation : Maroc

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2007
    Messages : 144
    Points : 50
    Points
    50
    Par défaut
    Merci abraxis,

    Le problème c'est que la fonction PHP update n'est pas exécutée :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    update: 'php/article/updateArticle.php', // updateArticle.php n'est jamais executé!!!
    avant d'atteindre la fonction getUpdateRecords :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    console.log(store.getUpdatedRecords());

  6. #6
    Membre régulier
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Novembre 2006
    Messages
    46
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Novembre 2006
    Messages : 46
    Points : 82
    Points
    82
    Par défaut
    Et que contient updateArticle.php ?

  7. #7
    Membre du Club
    Profil pro
    Développeur informatique
    Inscrit en
    Juin 2007
    Messages
    144
    Détails du profil
    Informations personnelles :
    Localisation : Maroc

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2007
    Messages : 144
    Points : 50
    Points
    50
    Par défaut
    Bonjour,

    Je dit :
    updateArticle.php n'est jamais executé!!!

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    update: 'php/article/updateArticle.php', // updateArticle.php n'est jamais executé!!!
    (voir le fichier 'ExtApp.store.article.Articles')

    Le fichier articleUpdate.php :

    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
     
    <?php
     
        echo 'update article.......';
         include('../MetaData.php');
            $exmp = new MetaData();
     
        //$exmp->update("f0011",$params);
        
            //print_r($exmp);
                    
     
             //$info = $_POST['data'];
            
             //print_r($info);
            // $data = json_decode(stripslashes($info));
     
            // $cdart = $data->cdart;
            // $design1 = $data->design1;
            // $ref = $data->ref;
            // $id = $data->id;
     
            // //consulta sql
            // $query = sprintf("UPDATE article SET 
            //              cdart = '%s', 
            //              design1 = '%s', 
            //              ref = '%s' 
            //      WHERE id=%d",
            //      mysql_real_escape_string($cdart),
            //      mysql_real_escape_string($design1),
            //      mysql_real_escape_string($ref),
            //      mysql_real_escape_string($id));
     
            // $rs = mysql_query($query);
     
            // echo json_encode(array(
            //      "success" => mysql_errno() == 0,
            //      "articles" => array(
            //              "id" => $id,
            //              "cdart" => $cdart,
            //              "design1" => $design1,
            //              "ref" => $ref
            //      )
            // ));
    ?>
    Le message 'update article.......' n'est jamais afficher.

Discussions similaires

  1. Réponses: 4
    Dernier message: 09/05/2012, 09h08
  2. Modifications non effectuées sur sortie de formulaire
    Par jojodid dans le forum VBA Access
    Réponses: 1
    Dernier message: 28/08/2008, 16h19
  3. Réponses: 3
    Dernier message: 24/02/2008, 21h34
  4. Modifications non effectuées
    Par loverdev dans le forum VB.NET
    Réponses: 1
    Dernier message: 04/06/2007, 09h47
  5. Réponses: 11
    Dernier message: 09/03/2007, 12h10

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo