Question

j'essaie d'afficher console.log(r.get('info')) mais j'obtiens le résultat sous la forme (an empty string).Qu'est-ce qui a pu causer cette erreur ?

var myst = Ext.getStore('MyStore');    
var r = myst.getAt(0);
myst.on('load', function() {
    r = myst.getAt(0);
    console.log(r);
    console.log(r.get('info'));
});


UPDATE 1

MODÈLE

Ext.define('MyApp.model.MyModel', {
    extend: 'Ext.data.Model',

    fields: [

        {
            name: 'info'
        }
    ]
});

MISE À JOUR 2

En fait, je reçois Object { phantom=true, internalId="ext-record-18", raw={...}, more...} quand j'imprime console.log(r)'et à l'intérieur, je vois info:"myname".

Était-ce utile?

La solution

Pour afficher un tableau ou des objets, essayez console.dir(object).

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top