PDA

View Full Version : How to reset Listener



petcy
13 Jan 2011, 8:24 PM
Hiii,

I wanna to show a form both in View Mode and in Edit mode..

In View Mode... i cleared the events like below...

Ext.getCmp('pin').events['blur'].clearListeners();

then is it possible to re activate the event['blur']....
in Edit/Add Mode ... If yes then pls show me how????

mdavis6890
13 Jan 2011, 8:48 PM
What is it really that you are trying to accomplish? What's "view mode?"

petcy
13 Jan 2011, 8:55 PM
okk i'm sorry

the View mode by which i meant the form that contains read only fields just for showing details and not for editing ...
so that i removed all the events like blur, focus...... as above #1.

But now i want to reset that event listeners.. how???

mdavis6890
13 Jan 2011, 9:53 PM
Can you just disable all the fields instead, then re-enable them for edit-mode? Trying to remove, then restore the listeners seems a very difficult way to get this done.

petcy
13 Jan 2011, 10:00 PM
not possible.. coz.. still after disable all the fields the listener will work.... that not allowed... thats why i cleared the listener...


is that possible to disable the event listener and re enable.. can u pls specify the piece of code???

mdavis6890
14 Jan 2011, 7:00 AM
I don't know how to do what you want. Why do you have to disable the listeners? That doesn't make sense to me.

darthwes
14 Jan 2011, 7:06 AM
Let's see, the documentation for form fields (http://dev.sencha.com/deploy/dev/docs/?class=Ext.form.Field) says that there are some usable methods you should look into.

Ext.form.Field.setReadOnly
Ext.form.Field.suspendEvents and Ext.form.Field.resumeEvents

Have a go at those.