PDA

View Full Version : [CLOSED] Change Listener has different behavior in version 2.x than in 1.x



MacGarnicle
Mar 28, 2012, 11:19 PM
I have two projects, one with Ext.NET 1.x and one with 2.x.

I run the following code in both the Ext.NET 1.x and the 2.x project:



<ext:TextField
ID="txtUsername"
runat="server"
FieldLabel="Username"
EmptyText="Enter your username"
AnchorHorizontal="100%">
<Listeners>
<Change Handler="console.log('changed');" />
</Listeners>
</ext:TextField>


In 1.x, the change event fires only when you lose focus (on blur) and there has been a text change ? This works as expected.

In 2.x, the change event fires every single time a key is pressed.

On a related note, I?ve also noticed that


<SpecialKey Handler="alert('I am special');? />

Fires only in 1.x, and it does not fire in 2.x.

Maybe I?m using it incorrectly, or there?s a change in 2.x that isn?t mentioned in the change log. Please let me know.

Thanks!

Daniil
Mar 29, 2012, 1:29 PM
Hi,

Yes, it has been changed and not listed in the changelog. We will add a respective item, thanks for the report.

Please note that it's documented in ExtJS docs:

Ext.NET v1 / ExtJS v3

Fires just before the field blurs if the field value has changed.
http://docs.sencha.com/ext-js/3-4/#!/api/Ext.form.Field-event-change

Ext.NET v2 / ExtJS v4

Fires when a user-initiated change is detected in the value of the field.
http://docs.sencha.com/ext-js/4-0/#!/api/Ext.form.field.Field-event-change



On a related note, I?ve also noticed that


<SpecialKey Handler="alert('I am special');? />

Fires only in 1.x, and it does not fire in 2.x.


Please start a new forum thread.

MacGarnicle
Mar 29, 2012, 3:42 PM
Thank you for your response.

The Ext.JS documentation is extremely helpful.

As for the special key, it actually does fire - I must have mixed something up yesterday.

What does behave differently though (as I notice) is the way I interact with objects. I had "btnLogin.fireEvent('click')" in the Handler for version 1.x. This doesn't work in 2.x. Now I find I have to use "Ext.getCmp('btnLogin').fireEvent('click')".

If you would like, I can start a new thread about that.

Thanks.

Daniil
Mar 29, 2012, 3:47 PM
Yes, please start a new forum thread.