PDA

View Full Version : Ext DirectStore Help.. Needed urgently



dadson77@yahoo.com
31 Aug 2009, 7:12 AM
Hi all,
I have a direct store defined as such:

store: {
paramAsHash: true,
xtype: 'directstore',
api:{load: Myserver.getData},

id: 'jaDirectStore',
reader:new Ext.data.JsonReader({
//totalProperty: 'total',
successProperty: 'success',
//idProperty: 'id',
root: 'data'
}, [
{ name: 'jaName' },
{ name: 'contact', allowBlank: false },
{ name: 'agency_org', allowBlank: false },
{ name: 'roles', allowBlank: false }
])
}


I do however get this error upon an attempt to load store.


[Exception... "'Ext.data.DataProxy: DataProxy attempted to execute an API-action but found an undefined url / function. Please review your Proxy url/api-configuration.' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)" location: "<unknown>" data: no]


What could the problem be? I just don't know what am doing wrong. Please help

Jack9
31 Aug 2009, 8:24 AM
If you type:

Myserver.getData

into a web browser, you should see the data you set up to serve to the store. If not, then the failure is due to the fact you have given it a bad (or nonexistent) url to load from. It can't even contact the URL so the store proxy fails and that's the error you are seeing.

dadson77@yahoo.com
31 Aug 2009, 9:47 AM
thanks jack9. I am able to call Myserver.getData from firebug, and i get a response from the server with the data.

The problem seems to be with the way the store has been configured or defined, but i don't know what am doing wrong.

Jack9
31 Aug 2009, 4:11 PM
I dont understand why you're using DirectStore. if you converted to most any other kind of store for calling a static url, you're fine.

You have chosen a store that is a complicated hybrid of 2 other complicated structures.
First a DirectStore IS a JsonReader as well as a DirectProxy. So looking at your code we can toss a couple lines:



//paramAsHash: true, // This is true by default. Try reading the docs.
//xtype: 'directstore', // Dont use this imo
//totalProperty: 'total', // Your test cases shouldnt have junk in it
//idProperty: 'id', // More junk
//reader:new Ext.data.JsonReader({ // As I said, this is inherent in the object
//successProperty: 'success', // Junk, as there is no failure handling

var myStore = new Ext.data.DirectStore({
id: 'jaDirectStore'
,root: 'data' // Moved this out, since this IS a JsonReader
,api:{
//load: Myserver.getData // load is not a valid ACTION for api.
//Might want to read the docs. You want "read:" not "load:"
read: Myserver.getData
}
,fields: [
{ name: 'jaName' },
{ name: 'contact', allowBlank: false },
{ name: 'agency_org', allowBlank: false },
{ name: 'roles', allowBlank: false }
]
});
...
store:myStore

dadson77@yahoo.com
1 Sep 2009, 5:25 AM
thanks jack9. Let me try that. I will let you know how i do.

regards,

Emmanuel