View Full Version : Combobox request to jsonreader

10 Sep 2009, 12:02 AM

I have read through the examples and I have been working from the forum search example on this. At present I have tested the combboox and dataview with locla data and that part works fine.

I am now trying to access a remote store through the scripttagproxy and jsonreader. However I am using livehttpheaders to check the request to the remote server.

On making any changes in the combobox it does not submit the query in the URL string. I have setup the default to return a single row with default text to display in the dataview.

var ds = new Ext.data.Store({
proxy: new Ext.data.ScriptTagProxy({
url: '',
method: 'GET'
reader: new Ext.data.JsonReader({
root: "result",
id: "id",

var resultTpl= new Ext.XTemplate({


var search = new Ext.form.ComboBox({
store: ds,
typeAhead: false,
loadingText: 'Searching...',
width: 570,
emptyText: 'Enter a search term',
tpl: resultTpl,
If I visit the url ( directly and add 'query=' so url is:
which I think the combobox should add by default the json string is returned in the format
{"result":[{"title":["No Result"], "summary":["None"], "id":1, "searchterm":""}]}]

Can anyone tell me why I am not getting the query parameter added to the get string from the store. And will this, once working, query the store each time a new term or text is added to the combobox?

The combobox is rendered in the center panel of a viewport. The url passes the query string to a python script and returns results in the format shown above.

Viewing the query to it is in the form of

And using the example I expected the query parameter to be added


10 Sep 2009, 12:34 AM
I realised that I had not added

valueField: 'title',Into the combobox.

However I can see in firebug that data is being returned now, but I am getting an error for invalid label?

The JSON string returned is:

{"result": [{"title":"Test search result", "summary":"its a test so nothing to display", "searchterm":"test", "id":1}]}

10 Sep 2009, 12:57 AM
I have fixed this issue now.

Having checked the returned result for scripttagproxy and comments by animal on other threads I realised that I hadnt included the callback with the returned json string.

instead of:

{"result": [{"title":"Test search result", "summary":"its a test so nothing to display", "searchterm":"test", "id":1}]}The callback must also be returned:

stcCallback1002({"result": [{"title":"Test search result", "summary":"its a test
so nothing to display", "searchterm":"test", "id":1}]});

It now works and thought would be useful for others to see the solution

20 Sep 2009, 11:30 PM
I see you had a problem and that you solve it.
I have similar problem too.

url: ''Tel me what type this file is?
I'm using PHP. And i guess that php should throw some output? or i'm doing wrong...
If not, how does it look like that output?
is it:

echo 'stcCallback1002({"result": [{"title":"Test search result", "summary":"its a test
so nothing to display", "searchterm":"test", "id":1}]});';?


21 Sep 2009, 12:45 AM

I am using python on the django framework.

All you need do is take the callback parameter passed in the get request and return that in the correct format with the JSON as the result from your script since the callback will change for each request and is passed in the url string as callback=