PDA

View Full Version : Java script error when using proxy url config in Store



psnprasad
31 Aug 2012, 3:21 AM
Hi,
I am getting java script error: "Object doesnt support this property or method". Here is the code i am using: Can any one pls help?


Ext.define('AM.store.Users', {
extend: 'Ext.data.Store',
model: 'AM.model.User',
autoLoad: true,

proxy: {
type: 'ajax',
api: {
read: {
url: '/myapp/users'
},
update: {
url: '/myapp/updateUsers'
}
},
reader: {
type: 'json',
root: 'users',
successProperty: 'success'
}

}
});

Farish
31 Aug 2012, 3:34 AM
you dont need to use url inside api. Just do it like:


api: {
read: 'url_read',
create: 'url_create',
update: 'url_update',
destroy: 'url_destroy'
}

psnprasad
31 Aug 2012, 3:36 AM
Thanks! I need to pass some params to where updating the store. How can I do that?

Farish
31 Aug 2012, 3:41 AM
you can append them to your url and extract them on your backend.


api:
{
read: 'url_read',
update: 'url_update&ID=' + id,
// ...
}

you can use setProxy method to change your urls.