PDA

View Full Version : Ext.form.ComboBox, change Event doesn't work


Enrico
04-17-2007, 10:52 PM
Hi Jack,

following code doesn't work. If I replace "change" by "select" it works perfect.


var customerChangeComboBox = new Ext.form.ComboBox({
typeAhead: true,
triggerAction: 'all',
transform: 'customer_customer_id',
width: 150,
forceSelection: true
});
customerChangeComboBox.on('change', function(box, record, index) {
...
});

jack.slocum
04-18-2007, 02:57 AM
change is the browsers change event. It doesn't always fire, which is why select exists. :)

RobbyRacoon
06-08-2007, 11:06 AM
Select works great as long as the user is only selecting items from the dropdown, but obviously doesn't fire when the user just edits the text portion. Since the change event also does not fire, how can I detect when the value of the text has been changed? Is there built-in support for this or do I have to roll my own?

jack.slocum
06-09-2007, 12:59 AM
Select works great as long as the user is only selecting items from the dropdown, but obviously doesn't fire when the user just edits the text portion. Since the change event also does not fire, how can I detect when the value of the text has been changed? Is there built-in support for this or do I have to roll my own?

"change" should fire when the user leaves the field if the text has changed. Is that not the behavior you are seeing?

RobbyRacoon
06-09-2007, 01:13 AM
"change" should fire when the user leaves the field if the text has changed. Is that not the behavior you are seeing?

Correct, I never see the change event fire. I will post the code I am using when I return to work tomorrow, surely there is a clue there that I am just not seeing.

leftstar
06-13-2007, 11:20 PM
Hi Jack,

following code doesn't work. If I replace "change" by "select" it works perfect.


var customerChangeComboBox = new Ext.form.ComboBox({
typeAhead: true,
triggerAction: 'all',
transform: 'customer_customer_id',
width: 150,
forceSelection: true
});
customerChangeComboBox.on('change', function(box, record, index) {
...
});



customerChangeComboBox.on('select', function(box, record, index) {

tryanDLS
06-14-2007, 12:14 AM
It would appear that change is only fired in Field.onBlur, but this is overridden by TriggerField.onBlur

jeffita
08-06-2007, 06:45 PM
Since it seems that the method was overidden, there was probably a good reason?
Is this currently considered a bug in version1.1? If so, are there plans to fix it?

Thank you!

kimu
08-20-2007, 08:46 AM
The same for me here. I can't find a way to fire the onchange event on a combobox.
I think is a bug and it seems to being somehow related with the same kind of bug on datefield which I wrote in this thread http://extjs.com/forum/showthread.php?t=4208

mystix
08-20-2007, 09:35 AM
this is already fixed in SVN.

see this post for a temp override (for Ext 1.1 final) till the next release of Ext.

kimu
08-20-2007, 10:28 AM
this is already fixed in SVN.

see this post for a temp override (for Ext 1.1 final) till the next release of Ext.

Thanks for the solution for datefield. There isn't anything similar for combobox yet, isn't it?

RobbyRacoon
08-20-2007, 10:29 AM
Thank you, I'll give that a try right away!

mystix
08-20-2007, 10:36 AM
Thanks for the solution for datefield. There isn't anything similar for combobox yet, isn't it?

if you look at the override, it's for Ext.form.Field, the superclass of both Ext.form.DateField and Ext.form.ComboBox.

i've tested the override with a ComboBox and it works fine.

let us know your results when u've used it.

kimu
08-24-2007, 01:01 PM
I haven't tested the override with a datefield but it works fine with comboboxes.
No way to have the change event on a triggerField anyway.
I've a triggerField that onTriggerClick show a dialog that asks a value which is set in the triggerField after dialog closing.
TriggerField doesn't fire the change event in a situation like that. It doesn't fires any event if the only interaction you have with the controll is to click on the trigger button.
You have to click once on the field to have some events to be fired.
I'm trying to make a fixaround for this too.

It's the first time I use Ext.form.field(s) and the event handling is a true nightmare...
Event handling has many bug in the whole Ext library. I think that it should be improved and intensively bug fixed (IMHO). I have found a bug on the beforeremove event of LayoutRegion and another one on blur event of textField.
I'm going to prepare some videos to show you how and when.

mystix
08-24-2007, 01:20 PM
It's the first time I use Ext.form.field(s) and the event handling is a true nightmare...
Event handling has many bug in the whole Ext library. I think that it should be improved and intensively bug fixed (IMHO). I have found a bug on the beforeremove event of LayoutRegion and another one on blur event of textField.
I'm going to prepare some videos to show you how and when.

that'd be good. if, as you've said, there are indeed horrible bugs in the event system then be sure to post some code / trace along with the videos to demonstrate the bugs in question so they can be eradicated.

also, if you have suggestions on ways to improve things, be sure to post them in the Prerelease forum. thanks.

chris
08-31-2007, 03:53 PM
The same for me here. I can't find a way to fire the onchange event on a combobox.
I think is a bug and it seems to being somehow related with the same kind of bug on datefield which I wrote in this thread http://extjs.com/forum/showthread.php?t=4208

Don't know if this will help but I ran into this issue with TextField. I wanted to filter a list in a grid when someone typed text into the TextField. Unfortunately the "change" event doesn't work because it only fires on a blur event, and since I wanted to do things dynamically the "change on blur" type event just wouldn't work.

Using a custom validator function I could mimic what I needed to do (do something when the field changed) but this doesn't run when the field is blank.

So I used the "valid" event which fires whenever the field validates (which happens whenever the field changes even in the context of the blur event not being fired). Of course if you are running a real validator on the field you could also use the "invalid" event as well to do what you need to do..

There's probably a better way to do this but it worked for me :)