PDA

View Full Version : RESTful web services manual



eef
29 Dec 2010, 7:56 AM
Hello, I am new to extjs and apologize if this has been covered before. I have a couple of questions about the Manual page for RESTful Web Services: http://www.sencha.com/learn/Manual:RESTful_Web_Services

First, it seems this doc was originally written around 2008. Is it perhaps dated or has extjs 3.3.x improved on the areas the author of the doc hoped for?

Second, I'm having trouble with the following code snippet:



Ext.Ajax.disableCaching = false;

var cb = new Ext.form.ComboBox({
store: new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: '/resource',
method: 'GET',
params: {
myquery: 'something'
}
}),
reader: new Ext.data.JsonReader({
fields: ['id']
})
}),
displayField: 'id',
valueField: 'id',
triggerAction: 'all',
renderTo: document.body
})



When I execute this, the parameters passed in the GET are not what I was expecting (i.e., "myquery=..."), but rather seem to come from the combobox as "query=...". I gather I can quiet the combobox by setting `queryParam` to an empty string, but how might I use `HttpProxy`s params?

Many thanks

Condor
29 Dec 2010, 8:14 AM
1. No, setting queryParam to an empty string is not supported (if you really wanted to, you could remove the parameter in the beforeload event).

2. HttpProxy doesn't have a 'params' config option; it has an 'extraParams' config option. However, it's more common to use the store baseParams for this.