PDA

View Full Version : Trying to dynamically add tabs and gridpanels



Elijah
11 Mar 2010, 5:47 AM
I have been trying to find out how to dynamically add tabs to a tab panel and to also add grid panels to the dynamically created tabs.

I cannot post code because the environment that I am developing on is not allowed to connect to the network so I have to bounce back and forth between machines.

However, what I am trying to do is in the Ext.onReady() create a new Ext.Window and inside there create a new TabPanel but for the items: [ ] i want to be able to lets say reference an already build grid panel (lets call grid panel gp) so I would like to do something like items: [gp1, gp2, gp3]

Of course its not working. Been looking over the api, examples, the forum and cant find how to add in an item that is built prior to the items:. Everything I have seen has things such as items:[{title:'Hello World Tab', html: 'blah blah blah'}]

Guidance sought on this. I have Ext JS 3.0 Cookbook and Learning Ext JS but neither appear to have infomation on how to do what I am trying to do.

If someone has done this or knows of a SPECIFIC forum post please post snippet or link to the thread.

Greatly appreciate it

Animal
11 Mar 2010, 6:16 AM
Time after time I tell people:



myTabPanel.setActiveTab(myTabPanel.add(myGridPanel));


Where, obviously, myTabPanel is a TabPanel, and myGridPanel is a GridPanel.

But you MUST learn the principle, or you'll just keep coming back here:

Add Components to Containers. And ensure that the Container is configured with the layout manager that you require.

Elijah
11 Mar 2010, 7:07 AM
But you MUST learn the principle, or you'll just keep coming back here:

I totally agree with you on this!

But where is the basis to start? Not the API and examples though some being very good leave it up to the person to decipher and assume things and trace out each item back to the api.

I would love a starting point as I feel thrown into the middle of a project with a unrealistic timeline and no onsite references. We here are all just trying to get things to work which is not the same as understanding how to get things to work.

Also for the myTabPanel.setActiveTab(myTabPanel.add(myGridPanel)); in regards to myTabPanel question for that is that it seems to require a destination for the renderto. How can you create a tabPanel and at a later point add it to some display point on the page? All examples are creating and adding tabPanel at the same time.

Also Animal looking through your signature the examples link I found how I can create grids and then add them to the tabs based on their js file http://examples.extjs.eu/source.php?file=gridintab.js Thanks for the links.

Animal
11 Mar 2010, 7:20 AM
I don't get it.

The API is the place to start.

ALL the information I keep posting again and again and again and again and again and again and again and again and again and again and again is there.

That's why I got so peed off with posting it! I wrote it once, and just have to keep pasting it into the forum because people can't be bothered to get it themselves.

Just add the grid to the TabPanel. The "add" method. It is documented.

Animal
11 Mar 2010, 7:20 AM
I don't get it.

The API is the place to start.

ALL the information I keep posting again and again and again and again and again and again and again and again and again and again and again is there.

That's why I got so peed off with posting it! I wrote it once, and just have to keep pasting it into the forum because people can't be bothered to get it themselves.

Just add the grid to the TabPanel. The "add" method. It is documented.

Animal
11 Mar 2010, 7:21 AM
Also for the myTabPanel.setActiveTab(myTabPanel.add(myGridPanel)); in regards to myTabPanel question for that is that it seems to require a destination for the renderto. How can you create a tabPanel and at a later point add it to some display point on the page? All examples are creating and adding tabPanel at the same time.




renderTo??? Why are you using rendering? READ the docs. It tells you not to render.