PDA

View Full Version : How to send extra information when store.load complete?



dranix
15 Nov 2011, 3:43 AM
Hi everyone
I have 2 combobox, and their data is filled by 2 stores.
When I select my first comboBox, the event is raise, and load the store for the second comboBox.
My problem is I need to send extra information from server to client when I call store.load().

I have tried messageProperty/successProperty/totalProperty but no hope
I also tried load event in store but still no luck


//country comboBox Store
var countryComboBoxStore = new Ext.data.JsonStore(
{
url: '@Url.Content("~/InitializecountryComboBox")',
autoLoad: false,
idProperty: 'id',
autoSave: true,
messageProperty: 'message',
root: 'countrys',
fields: ['id', { name: 'country_', type: 'string'}],
listener: {
load: new function (store, records, options) {
alert("load");
},
datachanged: new function (store) {
alert("Data change");
}
}
});
countryComboBoxStore.setDefaultSort('country_', 'asc');


//country Combobox pop up
var countryComboPopUp = new Ext.form.ComboBox({
id: 'countryComboPopUp',
typeAhead: false,
triggerAction: 'all',
fieldLabel: 'country',
editable: false,
lazyRender: true,
mode: 'local',
store: countryComboBoxStore,
valueField: 'id',
displayField: 'country',
listeners: {
select: function (combo, record, index) {
var selectedcityId = comboPopUp.getValue();
var selectedcountryId = countryComboPopUp.getValue();
comboBoxStore.load(
{
params: { selectedcityId: selectedcityId, selectedcountryId: selectedcountryId }
});
// comboPopUp.clearValue();
// comboPopUp.applyEmptyText();
}
}
});


//country Combobox
var countryCombo = new Ext.form.ComboBox({
id: 'countryCombo',
typeAhead: false,
triggerAction: 'all',
fieldLabel: 'city',
editable: false,
lazyRender: true,
mode: 'local',
store: countryComboBoxStore,
valueField: 'id',
displayField: 'country_'
});


//city comboBox Store
var comboBoxStore = new Ext.data.JsonStore(
{
url: '@Url.Content("~/InitializeComboBox")',
autoLoad: false,
idProperty: 'id',
root: 'listcity',
messageProperty: 'message',
autoSave: true,
fields: ['id', { name: 'city1', type: 'string'}]
});
comboBoxStore.setDefaultSort('city1', 'asc');


// create the comboBox in pop up
var comboPopUp = new Ext.form.ComboBox({
id: 'city',
typeAhead: false,
triggerAction: 'all',
fieldLabel: 'city',
editable: false,
lazyRender: true,
mode: 'local',
store: comboBoxStore,
valueField: 'id',
displayField: 'city1',
listeners: {
select: function (combo, record, index) {
var selectedcityId = comboPopUp.getValue();
var selectedcountryId = countryComboPopUp.getValue();
countryComboBoxStore.load({ params: { selectedcityId: selectedcityId, selectedcountryId: selectedcountryId} });
//countryComboPopUp.clearValue();
//countryComboPopUp.applyEmptyText();
}
}
});


//Create the comboBox in grid
var combo = new Ext.form.ComboBox({
typeAhead: false,
triggerAction: 'all',
editable: false,
lazyRender: true,
mode: 'remote',
store: comboBoxStore,
valueField: 'id',
displayField: 'city1'
});

Please help me
Any idea is appropriated

mitchellsimoens
18 Nov 2011, 1:32 PM
What "extra information" are you sending and how are you sending it?