In ExtJS I want to set extraParam in a controller. These extraParams should be used in a store.
I want to show data in my combobox based on a condition.
If condition 1 is satisfied the extraparam contains abc.1
Then the store loads data corresponding to a groupID to get data
..same for condition 2(abc.2).
how can i set extraparam?
//Store
abcStore: {
type: 'store',
proxy: {
type: 'ajax',
url: PPA_SERVICE_BASE_URL + 'any.Service',
paramsAsJson: true,
actionMethods: {
read: 'POST'
},
reader: {
type: 'json',
rootProperty: 'data'
},
}
}
//Combobox
xtype: 'combobox',
fieldLabel: 'Payment Stream Type',
labelWidth: 130,
width: 280,
editable: false,
margin: '0 10 0 0',
displayField: 'label',
allowBlank: false,
bind: {
store: '{abcStore}',
}
//Controller - function to load data
loadabcData: function(newValue) {
var me = this,
view = me.getView(),
viewModel = this.getViewModel(),
store = viewModel.getStore('abcStore'),
extraParam = {groupId: groupId};
store.getProxy().setExtraParams(extraParams);
store.load();
// How should i further set this groupID.I want to set groupId value as abc.1 on condition1 and //abc.2 on condition 2
},
You almost had it
loadabcData: function(condition) {
var me = this,
view = me.getView(),
viewModel = this.getViewModel(),
store = viewModel.getStore('abcStore'),
// ==> next line does the trick
groupId = (condition === 'Cond1') ? 'abc.1' : 'abc.2',
extraParam = {groupId: groupId};
store.getProxy().setExtraParams(extraParams);
store.load();
// How should i further set this groupID.I want to set groupId value as abc.1 on condition1 and //abc.2 on condition 2
},