PDA

View Full Version : Ext.data.DirectProxy doesn't work for me. What's wrong?



iryndin
18 Nov 2009, 9:57 AM
Hi guys! I cannot make Ext.data.DirectProxy load data into the store.
What am I doing wrong?

The code:


this.contactListStore = new Ext.data.JsonStore({
fields: ['name',
'phone',
'position'
],
autoLoad: true,
initialized: false,

root: 'contacts',
proxy: new Ext.data.DirectProxy({
directFn: function(obj,callback,proxy) {
var contacts = com.namespace.globals.GetUserContacts();
//console.debug(contacts);
return contacts;
}
})
});


Function com.namespace.globals.GetUserContacts() returns like this:



com.namespace.globals.GetUserContacts : function() {
console.log('com.namespace.globals.GetUserContacts runs...');
var result = {
contacts: [
{name: 'name1', phone: '1', position: 'pos1'},
{name: 'name2', phone: '2', position: 'pos2'},
{name: 'name3', phone: '3', position: 'pos3'},
{name: 'name4', phone: '4', position: 'pos4'}
]
};
return result;
}


What should I do to load data into store???