DeLe
DeLe

Reputation: 2480

Extjs 4.1 - How to get embed data inside store that sent from server

I have a grid panel and i want to get data that i embed in store
My json look like (embed is my embed data)

({"total":"20","results":[{...}], "embed": [{...}] })

How to get embed data in my load function. Thanks

var store = Ext.create('Ext.data.Store', {
     model: 'MyDataObject',
     autoLoad: true,
     pageSize:10,
     proxy: {
          type: 'ajax',
          url: 'data.php',
          reader: {
              type: 'json',
              totalProperty: 'total', // total data
              root: 'results'                       
          }
    }
    ,listeners: {
          load: function( store, records, successful, eOpts ){
               if (successful) {
                    alert(store.embed) // ?? how to get it      
               }
          }
    }
});

Upvotes: 1

Views: 899

Answers (1)

Evan Trimboli
Evan Trimboli

Reputation: 30092

The proxy keeps a reference to the rawData property for the most recent load.

console.log(store.getProxy().getReader().rawData.embed);

Upvotes: 2

Related Questions