innosia
30 Nov 2011, 1:22 AM
I have a combobox, when it expand I want it to get other textbox value, and set the value as parameter when calling the store.load({ params : { cocode : thisisvaluefromtextbox}})
Ext.define('CQT.store.trading.PriceList', {
extend: 'Ext.data.Store',
fields: ['PriceList'],
proxy: {
url: '../TradingCQM/GetPriceList',
type: 'ajax',
actionMethods: 'POST',
extraParams: { cocode: '' }
}
})
var txtPrice = Ext.create('Ext.form.field.ComboBox', {
id: 'txtPrice',
name: 'txtPrice',
xtype: 'combo',
valueField:'PriceList',
displayField:'PriceList',
hidden: false,
mode: 'remote',
emptyText: '(Input Price Here)',
resizable: false,
forceSelection:false,
store: store7,
autoLoad: false,
minChars: 1,
minListWidth: 320,
autoSelect: true,
enableKeyEvents: true,
loadingText: "wait...",
selectOnFocus: true,
width:100,
listeners: {
loadexception: {
fn: function (proxy, store, response, e) {
Ext.MessageBox.alert(alert_lbl, "Fail Loading Price");
}, scope: this
},
select: function (combo, record, index) {
var val = record[0].get("PriceList");
val = trim(val);
this.setRawValue(val);
},
blur : function() {
var val = this.getRawValue();
val = trim(val);
this.setRawValue(val);
},
expand: function (combo) {
//var compcode = Ext.getCmp('selectedSymbol').getValue();
var compcode = formPanel.down('[name=txtSelectedSymbol]').getValue();
store7.load({ params: { cocode : compcode } });
//ABOVE EVENT WILL FIRE ONCE with correct parameter
//HOWEVER AFTER EXPAND EVENT, it will fire one more time with '' AS PARAMETER WHICH IS THE DEFAULT VALUE OF THE STORE, WHY LIKE THIS?
}
}
});
However I notice the combobox is firing two events to reload the store
1. First Event, will call by the correct value from textbox
2. Second Event, will call using the default value when creating the store which is ''
Why is this behavior? Then I change the queryMode of the combobox to local, and it fire only one event.
The event will use textbox value as parameter correctly, then I change the textbox value to somethign else, and click the combobox dropdown, it will keep loading and waiting without firing the event anymore.
Why is this?
Please help, and please let me clarify that your product is really not suitable for sell, it is better to use for your own goodness, please spare people from stress of using your product.
Thanks
Ext.define('CQT.store.trading.PriceList', {
extend: 'Ext.data.Store',
fields: ['PriceList'],
proxy: {
url: '../TradingCQM/GetPriceList',
type: 'ajax',
actionMethods: 'POST',
extraParams: { cocode: '' }
}
})
var txtPrice = Ext.create('Ext.form.field.ComboBox', {
id: 'txtPrice',
name: 'txtPrice',
xtype: 'combo',
valueField:'PriceList',
displayField:'PriceList',
hidden: false,
mode: 'remote',
emptyText: '(Input Price Here)',
resizable: false,
forceSelection:false,
store: store7,
autoLoad: false,
minChars: 1,
minListWidth: 320,
autoSelect: true,
enableKeyEvents: true,
loadingText: "wait...",
selectOnFocus: true,
width:100,
listeners: {
loadexception: {
fn: function (proxy, store, response, e) {
Ext.MessageBox.alert(alert_lbl, "Fail Loading Price");
}, scope: this
},
select: function (combo, record, index) {
var val = record[0].get("PriceList");
val = trim(val);
this.setRawValue(val);
},
blur : function() {
var val = this.getRawValue();
val = trim(val);
this.setRawValue(val);
},
expand: function (combo) {
//var compcode = Ext.getCmp('selectedSymbol').getValue();
var compcode = formPanel.down('[name=txtSelectedSymbol]').getValue();
store7.load({ params: { cocode : compcode } });
//ABOVE EVENT WILL FIRE ONCE with correct parameter
//HOWEVER AFTER EXPAND EVENT, it will fire one more time with '' AS PARAMETER WHICH IS THE DEFAULT VALUE OF THE STORE, WHY LIKE THIS?
}
}
});
However I notice the combobox is firing two events to reload the store
1. First Event, will call by the correct value from textbox
2. Second Event, will call using the default value when creating the store which is ''
Why is this behavior? Then I change the queryMode of the combobox to local, and it fire only one event.
The event will use textbox value as parameter correctly, then I change the textbox value to somethign else, and click the combobox dropdown, it will keep loading and waiting without firing the event anymore.
Why is this?
Please help, and please let me clarify that your product is really not suitable for sell, it is better to use for your own goodness, please spare people from stress of using your product.
Thanks