PDA

View Full Version : Help me:Ext.form.ComboBox fail to load data



yjw
20 Aug 2009, 7:03 PM
My code is as follows:

Ext.onReady(function(){
var store = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url:'test.txt'}),
reader: new Ext.data.ArrayReader({}, [
{name: 'value'},
{name: 'text'}
])
});

var combo = new Ext.form.ComboBox({
store: store,
emptyText: 'Please select',
mode: 'remote',
triggerAction: 'all',
valueField: 'value',
displayField: 'text',
applyTo: 'combo'
});
});

test.txt is as follow:
[
['value1','text1'],
['value11','text11'],
['value111','text111'],
['value1111','text1111'],
['value11111','text11111'],
['value2','text2'],
['value22','text22'],
['value222','text222'],
['value2222','text2222'],
['value22222','text22222']
]

When I run the code, the data can't be loaded normally to display in the combobox.

Who can help me?