-
16 Mar 2013 6:23 PM #1
Unanswered: ExtJS Model URL
Unanswered: ExtJS Model URL
Hi guys,
I am trying to implement a GET data from the server, but ExtJs is sending weird url, take a look:
http://localhost:8098/rest/v1/distribution-list/1?id=1
It shouldn't send parameter 'id', how can i remove that?
this is my Model
Ext.define('Wave.model.DistributionList', {
extend: 'Ext.data.Model',
fields: [
{name: 'id'},
{name: 'name', type: 'string'},
{name: 'status', type: 'string'}
],
proxy: {
type: 'rest',
noCache: false,
reader: {
type: 'json'
},
actionMethods: {
create: 'POST',
read: 'GET', // defaults to GET
update: 'POST',
destroy: 'DELETE'
},
api: {
read: 'http://localhost:8098/rest/v1/distribution-list/',
create: 'http://localhost:8098/rest/v1/distribution-list/',
update: 'http://localhost:8098/rest/v1/distribution-list/',
destroy: 'http://localhost:8098/rest/v1/distribution-list/'
}
}
});
-
18 Mar 2013 11:37 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 435
- Answers
- 3102
This has been changed in 4.1.3 and 4.2.0. By default it will not send the id parameter unless you opt in with a config.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
18 Mar 2013 11:55 AM #3
im using 4.2.0, but I did not opt for that.
how can i remove the 'id=1'?
cheers
-
18 Mar 2013 12:09 PM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 435
- Answers
- 3102
I'm sorry... guess the config default changed from when it was first talked about. There is an appendId config on the Rest proxy that if you set to false should not send the id parameter.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
18 Mar 2013 12:15 PM #5
I have tried this, if appendId = false, it sends a url like this:
http://localhost:8098/rest/v1/distribution-list?id=1
-
18 Mar 2013 12:37 PM #6Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 435
- Answers
- 3102
We were chasing two different things. Remove the appendId config and to get rid of the url parameter you can try this override:
Code:Ext.define('Override.data.proxy.Rest', { override : 'Ext.data.proxy.Rest', buildRequest : function(operation) { delete operation.id; return this.callParent(arguments); } });Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
18 Mar 2013 12:52 PM #7
It removed /1
I´ll try to override buildUrl
I think it should send by default /{id} when a rest proxy is chosen
cheers


Reply With Quote