PDA

View Full Version : Factory of panels with same form fields inside



denmarkin
11 Feb 2010, 8:35 AM
Hi guys.

I have a TabPanel inside FormPanel.
Via button handler I want to create new panel and assign it as a new tab into my TabPanel. Problem is - I have a lot of form fields inside such panel.

I have a component which already contains all fields and button works first time. I believe I need a constructor which will create new instance of panel and return it into caller method. Then, caller method will assign returned panel to the TabPanel.

Correct me if I wrong please.

Plus, as I understand - I need to link all interactions inside panel throw links/scopes, not via ID's of elements, because I will have several instances. OR I must generate them on the fly (also as field names) according to count number of current tab.

Does anybody already implemented such "factory" of panels with fields?

Thanks in advance,
Den

denmarkin
15 Feb 2010, 3:26 AM
Still looking for help with creating of a bunch of same forms. Kinda bump!

flanders
15 Feb 2010, 5:54 AM
There are two ways do do this: By using a constructor-pattern or a factory-pattern.

Saki has written something on pre-configured classes: http://blog.extjs.eu/know-how/writing-a-big-application-in-ext/
An introduction to factories is given here: http://www.extjs.com/learn/Tutorial:Extending_Ext_for_Newbies

There is plenty on google about this, so just google for both patterns