PDA

View Full Version : REST Proxy appending ids twice



tkolo
20 Jun 2012, 6:46 AM
Hello,

I'm trying to make use of a REST Proxy, however I've encountered a very weird problem with URL generation.
Thing is, it's appended there twice, like this: (example with id = 1)
http://localhost/path/1?id=1

This format is unacceptable on the server side (well, for now at least), thus it doesn't work. I've tried to get rid of ?id by using buildURL() function but with no effect.

Some sample code:



Ext.define('MyApp.model.Entity', {
extend: 'Ext.data.Model',


idProperty: 'DbId',
fields: [
'DbId',
{
name: 'Name',
type: 'string'
},
{
name: 'type',
type: 'string'
}
],


proxy: {
type: 'rest',
reader: 'json',
noCache: false,
url: '/entity'
}
});

MyApp.model.Entity.load(1); //this will generate http://localhost/entity/1?id=1

Any ideas?

Regards
Tom

scottmartin
20 Jun 2012, 12:03 PM
Have a look at appendId: false in your proxy.

Scott.

tkolo
20 Jun 2012, 11:39 PM
Hi Scott,

Thank you for your answer, but this is not exactly what i expected. After setting appendId to false URL looks like this:
http://localhost/entity/?id=1
while i'd like it to look like this:
http://localhost/entity/1