PDA

View Full Version : TabPanel with only 1 content panel



JamesC
29 Jun 2008, 3:39 AM
Hi,

I would like to have a tab panel which just uses 1 content panel (a form) and when I add additional tabs, or change tabs, all they do is use that 1 content panel and update the form.

This would save rendering many form elements for every additional tab, since instead a simple update of each form element can be performed.

This sounds like a good idea, are there any pitfalls? How could this be implemented easily? I guess it would be an extension of tabpanel which doesnt actually change the content panel (but does update the strip items) and then fires an update event, which would be handled and would update the form?

Starfall
29 Jun 2008, 5:49 AM
Your idea is not clear...

Why do you need a TabPanel if you would like to use only 1 content panel?

By the way, rendering some new form elements doesn't seem like an issue of performance to me.

JamesC
29 Jun 2008, 6:23 AM
There are lots of form elements so performance would increase. With 1 content panel, when you change tabs all that has to be done is updating that single body element instead of having multiple copies of the same form all with exactly the same dom elements, just with different values.

evant
29 Jun 2008, 6:27 AM
The container architecture lets you do this, your structure would be:



TabPanel
Container Tab
Form Panel


From here, you just move the form around by calling remove/add on the appropriate container. The problem here is you'll need to track the form values for each tab and restore them as appropriate.

JamesC
29 Jun 2008, 6:45 AM
Yea, but the remove/add would cause extra work and relayout delays, no? Better would be if the body element stayed static and just the tabstrip changed the active tab element and the body just updated saving any remove/add of panels.

nicklepedde
3 Jul 2008, 2:39 AM
I had tried to do something similar at one point. (I no longer have any working code because I have since rearchitected my application.)

What I did was create the tab panel as a sibling of the body panel, and made the height of the tab body 0. So it was in effect empty tabs resting on top of the body, and I just setup a listener for the tab change.

Though I am curious, why do you need this setup?

JamesC
26 Jul 2008, 1:00 PM
Anyone any more ideas on this, it is causing a great slowdown having all those extra dom nodes on the page rather than just 1 content panel!