0

I am trying to display console.log(r.get('info')) but, i am getting the output as (an empty string). What might have caused this error ?

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

MODEL

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

    fields: [

        {
            name: 'info'
        }
    ]
});

UPDATE 2

I actually get Object { phantom=true, internalId="ext-record-18", raw={...}, more...} when i print console.log(r)'and inside raw, i see info:"myname".

Illep
  • 16,375
  • 46
  • 171
  • 302
  • 1
    Please post the response from the server. It is likely that the returned data does not include an `info` field or it is misspelled. Also what does the `MyStore` model look like? – egerardus Jul 25 '12 at 17:34
  • I have added the Model of my application. – Illep Jul 25 '12 at 17:40

1 Answers1

1

To display array or objects try console.dir(object).

Festim
  • 201
  • 1
  • 3
  • Thank you for the help. Your suggestion helped me to get more information about the error. It was in the Store. – Illep Jul 25 '12 at 17:55