View Full Version : suspend panel and its all form components

27 Aug 2009, 3:18 AM
Is it possible to suspend a panel, I mean all component's events which are items of this panel.

I need such a thing, because I have many component and while initializing them before calling setValue function I have to suspend these components individually...
And remusing after setting value...

Thanks for your advance.

27 Aug 2009, 3:29 AM
You want to suspend events being fired by Ext.form.Fields?

All events, or just 'change'?

If so, you could use class level observability on Ext.form.Field to add a class-level listener for the event you want to suspend which would cancel the event by returning false.

27 Aug 2009, 3:36 AM
Dear Animal,
I only call setValue() method of components created from form classes. :)

So I need a trick way of suspending related events of components in a container.

I mean, "somehow" is it possible to suspend this container for such a porpuse.

Thanks Animal for your help.

27 Aug 2009, 3:44 AM
Actually I just solve this problem (not elegant way) by this way.
Just creating a list which contains id's of the components.
and creating a suspendEvents() and resumeEvents() functions which takes a list.

And before calling setValue functions, I call suspendEvents() methods and after finishing setvalue part calling resumeEvents()...

I shuold at least passing a container id (and searching its components)... :">

Thanks Animal.

27 Aug 2009, 3:52 AM
What events do you want to suspend on what kind of Components?

If it is Fields, you can do

Ext.form.Field.prototype.eventsSuspended = true;

Which will stop ALL Fields firing events

27 Aug 2009, 4:10 AM
Dear Animal,

I use:
- combo (using select event)
- checkbox (using check event)
- numberfield (using keyup event)
- colorpicker (I extend from triggerfield) (I create a custom event "ColorValueChanged" fired on validateValue function)

I try your suggestion, And It seams to work.
Before I try, "Ext.form.Field.prototype.eventsSuspended" value is undefined.
Therefore, to resume all events I reset it as "undefined" after I setting the values.

Thanks a lot Mr. Animal.

27 Aug 2009, 4:48 AM
Well, obviously. Set it to false to indicate that events are not suspended!