PDA

View Full Version : Dynamically populating the panel?



new2extjs
26 Jan 2012, 1:44 AM
How can we dynamically populate items in the panel from the database ? Also if I add a new field in the UI, it should be automatically added in the database and then fetched as an item of the panel.
Any hints?
Thanks in advance.

jay@moduscreate.com
27 Jan 2012, 1:39 PM
I suggest reading up on the component lifecycle as well as container add/remove. Check out the guides for these types of documents.

findajit
28 Jan 2012, 5:19 AM
@new2extjs

Typical steps are:

1. From the UI, make an Ajax call to read the config object from the database
2. In the success callback, instantiate the appropriate ExtJS component by passing the read config information
3. Add the newly created component to the appropriate container

In case you are defining your own component and want to encapsulate this behavior inside it, then you may put the logic inside the initComponent or onRender methods of your component depending upon your application design.