Reputation: 2803
I am new to ExtJs, I created a data Model in extJs then i create a store of that model and i am loading data on store using url, now i want to see the data available in that store , how i can do that?
My Data model code
Ext.define('MyModel', {
extend: 'Ext.data.Model',
proxy: {
actionMethods: {create: "POST", read: "POST", update: "POST", destroy: "POST"},
type: 'ajax'
}
});
My Store code
var MyStore = Ext.create('Ext.data.Store', {
model: 'MyModel',
pageSize: 50,
remoteSort: true,
remoteFilter: true,
remoteGroup: true
});
How i am loading values in store
MyStore.load({url: 'xyz.json'});
Upvotes: 2
Views: 3923
Reputation: 527
You can add callback method when calling store load. For example:
MyStore.load({
url: 'xyz.json',
callback: function(records, operation, success){
console.log(records);
}
});
Read more here http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.Store-method-load
Upvotes: 1
Reputation: 1368
You can trigger an explicit event after you initialize your store.
// This will ensure that the store is loaded before you log the records.
MyStore.on('load', function(store) {
var records = store.getRange();
console.log(records); // The data you want to see.
});
You can also add load event in the class. You may refer here. The most important part is the getRange()
method. This will return all the data from the store.
Upvotes: 1