PDA

View Full Version : How to use EXT's anonymous method in another JavaScript method



keaned
2 Apr 2008, 6:02 PM
I have a addRow() method in the Ext.onReady() , I want to use it in another JavaScript's method.
How can do it ?

evant
2 Apr 2008, 6:10 PM
You mean the method is defined inside onReady? If so, you can't it's out of scope. Why not just declare the method outside of the onReady block?

keaned
2 Apr 2008, 6:47 PM
the addRow() method will use the store object and grid object, but they are in EXT.onReady()

Animal
2 Apr 2008, 11:40 PM
I assume you are using the "function soup" approach to Javascript design.

If you create a Javascript Class which encapsulates the UI element that you want to use, then you would have a scope which contains member methods and member variables which would all be able to see and use each other.