vpasam
8 Feb 2008, 10:46 AM
I am trying to reload the combo box (with a data store) when I click a button which uses Ajax.request to do some back end processing. I am trying to do ths in the "Success" part of the Ajax request. I tried using :
usersCombo.store.reload();
usersCombo.store.load();
Below is the code :
Ext.Ajax.request({
waitMsg: 'Processing ...',
url:'AccountServices',
params: paramsURL,
method: 'GET',
success: function ( result, request ) {
var jsonData = result.responseText;
var addStatus = Ext.util.JSON.decode(jsonData);
if(addStatus.exists == 'true')
{
usersCombo.store.reload();
},
failure: function ( result, request) {} });
var dsCombo = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: 'AccountServices?task=load',
method: 'get'
}),
reader: new Ext.data.JsonReader({
root: 'users'
}, [
{name: 'logonid'},{name: 'lastName'}, {name: 'middleName'}, {name: 'firstName'}
])
});
dsCombo.load();
var usersCombo = new Ext.form.ComboBox({
loadingText: "Loading Data....",
allowBlank: false,
store: dsCombo,
displayField:'logonid',
typeAhead: true,
mode: 'local',
emptyText:'Select a Logonid...',
editable: true,
selectOnFocus:true,
resizable:true,
onSelect: function(record){
this.setValue(record.data.logonid);
this.collapse();
} });
var viewport = new Ext.Viewport({
layout: 'border',
items: [{
region: 'north',
height: 100,
title: ''
}, {
region: 'west',
width: 300,
minSize: 50,
collapsible: true,
split: true,
title: 'Search',
items: [usersCombo,leftForm]
},{
region: 'center',
title: 'User Account Information',
items: [login]
}, {
region: 'south',
height: 150,
minSize: 100,
collapsible: true,
collapsed: false,
split: true,
title: 'Information'
}
]});
Thanks
Venkat
usersCombo.store.reload();
usersCombo.store.load();
Below is the code :
Ext.Ajax.request({
waitMsg: 'Processing ...',
url:'AccountServices',
params: paramsURL,
method: 'GET',
success: function ( result, request ) {
var jsonData = result.responseText;
var addStatus = Ext.util.JSON.decode(jsonData);
if(addStatus.exists == 'true')
{
usersCombo.store.reload();
},
failure: function ( result, request) {} });
var dsCombo = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: 'AccountServices?task=load',
method: 'get'
}),
reader: new Ext.data.JsonReader({
root: 'users'
}, [
{name: 'logonid'},{name: 'lastName'}, {name: 'middleName'}, {name: 'firstName'}
])
});
dsCombo.load();
var usersCombo = new Ext.form.ComboBox({
loadingText: "Loading Data....",
allowBlank: false,
store: dsCombo,
displayField:'logonid',
typeAhead: true,
mode: 'local',
emptyText:'Select a Logonid...',
editable: true,
selectOnFocus:true,
resizable:true,
onSelect: function(record){
this.setValue(record.data.logonid);
this.collapse();
} });
var viewport = new Ext.Viewport({
layout: 'border',
items: [{
region: 'north',
height: 100,
title: ''
}, {
region: 'west',
width: 300,
minSize: 50,
collapsible: true,
split: true,
title: 'Search',
items: [usersCombo,leftForm]
},{
region: 'center',
title: 'User Account Information',
items: [login]
}, {
region: 'south',
height: 150,
minSize: 100,
collapsible: true,
collapsed: false,
split: true,
title: 'Information'
}
]});
Thanks
Venkat