View Full Version : Remote Combo Box

24 Mar 2010, 4:31 AM
Hi, I have problem populating combo box with Remote data:

Here is my code:

var TheStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: 'countries.php',
method: 'GET'

reader: new Ext.data.JsonReader({
root: 'rows',
fields: ['id_ctr', 'name_ctr']

autoLoad: true
var myform = new Ext.FormPanel({
url: 'index.html',
renderTo: Ext.get('form1'),
title: 'User Registration Form',
frame: true,
width: '320',
collapsible: true,
xtype: 'textfield',
name: 'username',
fieldLabel: 'Username',
allowBlak: false,
vtype: 'user'
xtype: 'combo',
store: TheStore,
fieldLabel: 'Country',
name: 'country',
valueField: 'id_ctr',
displayField: 'name_ctr'

The JSON returned is:
{rows: [{"id_ctr":"1","name_ctr":"Pakistan"},{"id_ctr":"2","name_ctr":"Saudia Arabia"},{"id_ctr":"3","name_ctr":"China"},{"id_ctr":"4","name_ctr":"Iran"}]}

Now the problem is that the combo box is empty. Can you please point out whats wrong with this?


10 Apr 2010, 3:21 AM
I just had the same problem! What you have to do is to remove autoLoad: true and add triggerAction: 'all' to your combo! Wasted 2 precious hour trying to fix this as the book I am reading from has a buggy example for loading combo box remote data...

10 Apr 2010, 11:03 AM
autoload and trigger actionsshould work.
id_ctr != Default "id" that may be a problem