andrewjbaker
6 Dec 2007, 9:09 AM
Hi all,
I've successfully populated a SimpleStore using Ext.Ajax.request() and bound the SimpleStore to a ComboBox. This method works... wahoo!
But...
I would prefer to use Ext.data.HttpProxy to retrieve the data (sent as JSON from the GetAllValues.ashx generic handler.) My code at present consists of:
var store1 = new Ext.data.SimpleStore({
fields: ['key', 'value'],
method: 'GET',
proxy: new Ext.data.HttpProxy({ url: 'Bsl/GetAllValues.ashx?methodName=Execute&args=AbsenceCategories' }),
reader: new Ext.data.JsonReader(
{ id: 'key' },
[ { name: 'key', mapping: 'key' },
{ name: 'value', mapping: 'value' } ]
),
remoteSort: false
});
var comboBox1 = new Ext.form.ComboBox({
displayField: 'value',
emptyText: '...',
fieldLabel: 'Key',
mode: 'local',
selectOnFocus: true,
store: store1,
triggerAction: 'all',
typeAhead: true,
valueField: 'key',
width: 192
});
/* ... */
Put quite simply; it ain't working. Firebug finds no errors and yet comboBox1 isn't populated. For the curious, GetAllValues.ashx returns:
[["MAT","Maternity/Paternity leave"],["OTH","Other paid authorised absence, e.g. compassionate leave"],["PUB","Paid absence for public duties"],["SEC","Secondment"],["SIC","Sickness"],["TRN","Training"],["UNA","Unauthorised absence"],["UNP","Unpaid, authorised absence"]]
Any ideas folks?
I've successfully populated a SimpleStore using Ext.Ajax.request() and bound the SimpleStore to a ComboBox. This method works... wahoo!
But...
I would prefer to use Ext.data.HttpProxy to retrieve the data (sent as JSON from the GetAllValues.ashx generic handler.) My code at present consists of:
var store1 = new Ext.data.SimpleStore({
fields: ['key', 'value'],
method: 'GET',
proxy: new Ext.data.HttpProxy({ url: 'Bsl/GetAllValues.ashx?methodName=Execute&args=AbsenceCategories' }),
reader: new Ext.data.JsonReader(
{ id: 'key' },
[ { name: 'key', mapping: 'key' },
{ name: 'value', mapping: 'value' } ]
),
remoteSort: false
});
var comboBox1 = new Ext.form.ComboBox({
displayField: 'value',
emptyText: '...',
fieldLabel: 'Key',
mode: 'local',
selectOnFocus: true,
store: store1,
triggerAction: 'all',
typeAhead: true,
valueField: 'key',
width: 192
});
/* ... */
Put quite simply; it ain't working. Firebug finds no errors and yet comboBox1 isn't populated. For the curious, GetAllValues.ashx returns:
[["MAT","Maternity/Paternity leave"],["OTH","Other paid authorised absence, e.g. compassionate leave"],["PUB","Paid absence for public duties"],["SEC","Secondment"],["SIC","Sickness"],["TRN","Training"],["UNA","Unauthorised absence"],["UNP","Unpaid, authorised absence"]]
Any ideas folks?