PDA

View Full Version : Combobox Expand firing two events



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

tvanzoelen
30 Nov 2011, 2:00 AM
put this on your combo



queryMode: 'local',
triggerAction: 'all'


and plz use code tags around your code.

innosia
30 Nov 2011, 2:53 AM
It is working half only
1. I input textbox and it load combobox store using textbox value as paramter
2. I open combobox and see the correct list
3. I change the textbox and it load combobox store using textbox value as parameter, the correct list is returned from server
4. when I click the combobox, the combobox display loading and waiting endlessly.........

SO NOW HOW?
May I know how many clients your company has?

tvanzoelen
30 Nov 2011, 2:56 AM
Don't yell at me, I am only helping. Look at this maybe it is a bug

http://www.sencha.com/forum/showthread.php?156908-combobox-queryMode-local-still-shows-loading

Thats



Try setting loadMask to false in the listConfig Object on the ComboBox. That will not allow the BoundList to show that loading mask.


Or


Ext.override(Ext.LoadMask, {
onHide: function() { this.callParent(); }
});

tvanzoelen
30 Nov 2011, 3:07 AM
Strange I never faced this problem and I see now why, I have put this on my combobox



defaultListConfig: { emptyText: "", loadingText: "Loading...", loadingHeight: 70, loadMask: false}

innosia
30 Nov 2011, 7:17 PM
bump this thread up

tvanzoelen
1 Dec 2011, 12:19 AM
Just mark best answer.

innosia
24 Jan 2012, 12:08 AM
It is not working!!
To my surprise it looks as if it is working up until when I use keyboard to press down arrow to expand the combo, the combo won't load any list and this happens randomly (only sometimes).

So guess what? Your product sucks!

lorezyra
24 Jan 2012, 5:22 PM
It is not working!!
...
So guess what? Your product sucks!

LOL. You sound like some impatient, little kid that wants the toys to dance and spontaneously morph into bigger, better toys...


Granted there are bugs that the geniuses at Sencha are aware of and have been tirelessly working to resolve. If you were truly an experienced web developer, you would have spent more time investigating the source (of the framework) and searching deep inside the forums for your issue(s). This is of course after perusing the API docs.

This framework is used by many big-name companies that have smart development teams that figure all of this stuff out. They are the ones that make it work

lorezyra
24 Jan 2012, 5:26 PM
You can take either one of tvanzoelen (http://www.sencha.com/forum/member.php?32684-tvanzoelen) answers to resolve your problem. I have experienced the same issue that you described above. I resolved it with the same override that tvazoelen coped from another thread.

Alternatively, you can disable the loadmask altogether if you don't need it.

lorezyra
24 Jan 2012, 5:28 PM
I...

Ext.define('CQT.store.trading.PriceList', {
//unreadable code...
});
...
Thanks

Please use either the PHP or CODE tags to make it easy to read your code...