1. #1
    Sencha User
    Join Date
    Feb 2010
    Posts
    343
    Answers
    14
    Vote Rating
    3
    maneljn is on a distinguished road

      1  

    Default Unanswered: extjs 4.2 store.sync() don't refresh returned data anymore ?

    Unanswered: extjs 4.2 store.sync() don't refresh returned data anymore ?


    With extjs 4.1.1.a when i sync() a store, and then in php i return json data of refreshed record, the model record and the grid is automatically refreshed.

    Now i am upgrading to ext v4.2 and this doesn't work anymore.
    I have not changed nothing in my source code

    Is it normal ?
    -------------------
    Manel Juàrez

  2. #2
    Sencha User
    Join Date
    Feb 2010
    Posts
    343
    Answers
    14
    Vote Rating
    3
    maneljn is on a distinguished road

      0  

    Default


    sorry i correct the question.

    In this problem i do a model.save() (not a store.sync()) using direct proxy api update function
    And the returned data looks like this:

    Code:
    {"type":"rpc","tid":10,"action":"esicontactos_contactos","method":"updateContacto","result":{"success":true,"data":[{"cto_id":"63","cto_guid":"5050a5317736a","cto_tipo":"E","cto_sexo":"","cto_nombre_propio":"","cto_apellidos":"","cto_nombre_fiscal":"ACME INC.","cto_nombre_com":"","cto_nif":"","cto_nacimiento":null,"cto_idioma":"es_ES","cto_observaciones":"observa\nPEPITOR\nMAR\u00cda\ndf \nvs\nvs\nfv s\nfv \nsfv\n sdfv\n sv\n sfv\ns df\nv sd\nfv s\nf s\nf sd\nfv sd\nf sd\nfv \n","cto_activo":"1","cto_usralta_id":"1","cto_fechaalta":"2012-09-12 17:07:29","cto_usrmod_id":"1","cto_fechamod":"2013-04-11 16:16:14","dir_id":"50","dir_guid":"5050a53177b63","dir_contacto_id":"63","dir_fiscal":"1","dir_alias":"","dir_via":"PL","dir_nom":"CREU DE LA M\u00c0","dir_num":"1","dir_esc":"2","dir_pis":"3","dir_pue":"4","dir_direc1":"PL CREU DE LA M\u00c0 1 2 3 4","dir_direc2":"","dir_pos":"08001","dir_pob":"BARCELONA","dir_pro":"","dir_pais_iso3":"ESP","dir_tel1":"","dir_tel2":"","dir_fax":"","dir_email":"","dir_web":"","dir_activo":"1","dir_usralta_id":"1","dir_fechaalta":"2012-09-12 17:07:29","dir_usrmod_id":"1","dir_fechamod":"2013-04-11 16:16:14","cto_edad":null,"cto_gruposcontactos_asignados":[0],"cto_esUsuario":"0","cto_usralta_nombre":"JU\u00c0REZ NICOLAU, MANEL","cto_usrmod_nombre":"JU\u00c0REZ NICOLAU, MANEL"}],"total":"1"}}
    The model
    Code:
    //@charset UTF-8
    
    // Modelo de datos para los contactos
    Ext.define('esicontactos.model.contacto', {
        extend: 'Ext.data.Model',
        
        idProperty: 'cto_id',
        fields: [
            { name: 'cto_id',                     type: 'integer' },
            { name: 'cto_guid',                     type: 'string' },
            { name: 'cto_tipo',                     type: 'string' },
            { name: 'cto_sexo',                     type: 'string' },
            { name: 'cto_nombre_propio',         type: 'string' },
            { name: 'cto_apellidos',             type: 'string' },
            { name: 'cto_nombre_fiscal',         type: 'string' },
            { name: 'cto_nombre_com',            type: 'string' },
            { name: 'cto_nif',                    type: 'string' },
            { name: 'cto_nacimiento',            type: 'date', dateFormat: 'Y-m-d' },
            { name: 'cto_idioma',                type: 'string' },
            { name: 'cto_edad',                 type: 'integer' },
            { name: 'cto_observaciones',        type: 'string' },
            { name: 'cto_activo',                type: 'boolean' },
            { name: 'cto_esUsuario',            type: 'boolean', persist: false },
            
            // Vienen y van los ids de grupos asisnados en un  array de integers
            { name: 'cto_gruposcontactos_asignados', type: 'auto' },        
    
            // Direccion fiscal
            { name: 'dir_via',                type: 'string' },
            { name: 'dir_nom',                type: 'string' },
            { name: 'dir_num',                type: 'integer' },
            { name: 'dir_esc',                type: 'string' },
            { name: 'dir_pis',                type: 'string' },
            { name: 'dir_pue',                type: 'string' },
            { name: 'dir_direc1',            type: 'string' },
            { name: 'dir_direc2',            type: 'string' },
            { name: 'dir_pos',                type: 'string' },
            { name: 'dir_pob',                type: 'string' },
            { name: 'dir_pro',                type: 'string' },
            { name: 'dir_pais_iso3',        type: 'string' },
            { name: 'dir_tel1',                type: 'string' },
            { name: 'dir_tel2',                type: 'string' },
            { name: 'dir_fax',                type: 'string' },
            { name: 'dir_email',            type: 'string' },
            { name: 'dir_web',                type: 'string' },
            
            { name: 'cto_usralta_id',            type: 'integer', persist: false },
            { name: 'cto_fechaalta',             type: 'date', dateFormat: 'Y-m-d H:i:s', persist: false },    
            { name: 'cto_usrmod_id',            type: 'integer', persist: false },
            { name: 'cto_fechamod',             type: 'date', dateFormat: 'Y-m-d H:i:s' },        // Este campo se usará para el aviso de sobreescritura en concurrencia (2 usuarios grabando en el mismo registro a la vez)
            { name: 'cto_usralta_nombre',         type: 'string', persist: false },
            { name: 'cto_usrmod_nombre',         type: 'string', persist: false }
        ]
        
    });
    The store
    Code:
    Ext.define('esicontactos.store.contactos', {
        extend: 'Ext.data.Store',
    
        requires: [
            'esicontactos.model.contacto'
        ],
    
        constructor: function(cfg) {
            var me = this;
            cfg = cfg || {};
            me.callParent([Ext.apply({
                autoLoad: false,
                autoSync: false,
                buffered: false,
                model: 'esicontactos.model.contacto',
                remoteSort: true,
                remoteFilter: true,
                pageSize: 50,
                proxy: {
                    type: 'direct',
                    batchActions: false,
                    paramAsHash: true,
                    extraParams: {  
                        buscar: null
                    },
                    api: {
                        read: Ext.esicontactosDirect.esicontactos_contactos.getContactos,
                        create: Ext.esicontactosDirect.esicontactos_contactos.createContacto,
                        update: Ext.esicontactosDirect.esicontactos_contactos.updateContacto,
                        destroy: Ext.esicontactosDirect.esicontactos_contactos.destroyContacto
                    },
                    reader: {
                        type: 'json',
                        root: 'data',
                        idProperty: 'cto_id',
                        totalProperty: 'total',
                        successProperty: 'success',
                        messageProperty : 'message'                    
                    }
                }
            }, cfg)]);
        }
    
            
    });
    The returned data is not refreshed in the model record.
    -------------------
    Manel Juàrez

  3. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    5
    Vote Rating
    0
    alsid is on a distinguished road

      0  

    Default


    Can you show the code which inserts new record into the store before calling save() or sync() functions?

    I had similar issue with ExtJs 4.2. I was getting an empty record with reader, modifying it (filling all the fields) and than calling sync() method expecting that fields which were not filled would be updated. Particularly I was expecting that ID field will be populated with value generated by server. At least it was working like that with prior versions of ExtJs.

    With ExtJs 4.2 I've got a problem. Returned data was OK but id field of the record wasn't refreshed. The problem appeared to be with the sequence of sync operations which was generated by proxy object. In my scenario proxy was generating an update operation which assumes that record has normal id. I solved my issue by setting id property with setId() method of the model to null or empty value. After that proxy started generating insert operation which was right. I know that the whole thing about such way of inserting record is not good but the problem was not in my code so I decided not to change it a lot.

    I think your problem is also related to Ids.
    Hope it will help.

  4. #4
    Sencha User
    Join Date
    Oct 2011
    Posts
    35
    Vote Rating
    2
    ejerrywest is on a distinguished road

      0  

    Default


    I had the same problem, that appeared in 4.2.

    Found that I was calling "store.commitChanges" before I was calling "store.sync". When I took that out it handled the problem

Thread Participants: 2

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar