PDA

View Full Version : Need Clarity on Dynamic panel replacement in a viewport of border layout



Avinash P S
14 Feb 2013, 8:13 AM
Hi ,

I am a new user of Ext js 4.1.3 and i must say its very impressive. i almost got down some 10 screens in like a week., job well done team !!

i have a query which i wanted addressed. I have a view port with border layout in a js file and another js file holds an accordion with buttons to show up as menu and sub menus and yet another js file where i have built close to 10 different components / grids etc which i have placed into a type Ext.panel.Pane(10 of them) with a variable reference and an ID.
Now the accordion i place in the left border items array and i can place any of these 10 panels singly by their variable name specified in the 3rd js in the center border layout and show them up.
now i wanted to use a generic function that will fit in as the handler function in the accordion buttons (menus/sub menus- many of them) and on click i want to change the panel i built in the 3 rd js and show up in the center layout depending on what i have clicked on.

i tried using getCmp and holding the variable in the viewport js. but i am stuck on the logic flow where i want to place a particular panel on click of a particular button . i tried various things but i kept getting common errors such as not defined etc.

Can you help place me in the right direction. how should i resolve this ? maybe this is basic functionality but unfortunately i havent got it. so i'd appreciate any help that comes my way.

mitchellsimoens
17 Feb 2013, 8:21 AM
So you want to replace the component in the center region?

Avinash P S
17 Feb 2013, 8:49 AM
Hi ,
Thank you for your reply. i was just going to post that i created the components and hid them using the .hide() method and within the accordion , for each of the many buttons i had a handler that .show() the panel i wanted to display in the center and .hide() ; hid the rest and then i added all the component names in the items array of the center region.

Is this an acceptable method ? are there other ways ? i ask simply because i am currently using static data and soon will start coding it into a Spring Framework and will be pulling data from a database and converting it to json ad showing it on the front end . Will rendering all panels initially be a cause for concern in terms of delay that need not be there if there was a better approach may be ?