I am new in sencha touch application development .I am trying to load some data from remote we server to a list . I created a Store like the following
Ext.regStore('customers',{
model : 'customer',
sorters : 'firstName',
storeId : 'customers',
data : [{
id : 100,
firstName : 'aaa'
}, {
id : 101,
firstName : 'sss'
}, {
id : 102,
firstName : 'rrrr'
}]
});
Now I need to modify this store to retrieve data from external server.Follwoing is the code i am using right now
var customers = new Ext.data.JsonStore({
model : 'customer',
proxy : {
type : 'ajax',
url:'http:sample.com',
reader : {
type : 'json',
root : '',
},
},
listeners : {
datachanged : function() {
customers.each(function(r) {
console.log('data in record is:'+ r.get('name'));
});
}
},
});
Now my doubt is that how to register this JSON store like the inital code to access the store from another viewcontroller file.
Thanks in advance