View Full Version : [CLOSED] Rendering butons on a row in a tab

Sep 24, 2008, 10:22 AM
In the example I add buttons in a Tab of a TabPanel (taking data from an external class called pmappa). It's all dinamically built. The problem there is the buttons are shown in a column (one under the other) and not in a row. I tried to figure out how to change the layout but couldn't get it out.

I also have one more question: is there a way to dynamically add event handlers to work at server side?

Sorry if these things have been already discussed, but not having any documentation make things a bit difficult to me.

protected void Render_pmappa(pmappa m)
Coolite.Ext.Web.TabPanel tabs = new Coolite.Ext.Web.TabPanel();
tabs.ResizeTabs = true;
tabs.MinTabWidth = Unit.Pixel(115);
tabs.TabWidth = Unit.Pixel(135);
tabs.EnableTabScroll = true;
tabs.Width = Unit.Pixel(600);
tabs.Height = Unit.Pixel(80);
tabs.ActiveTab = 0;
tabs.BodyBorder = false;
tabs.Border = true;
for (int i = 1; i <= m.mondi.Count; i++)
Coolite.Ext.Web.Tab tab = new Coolite.Ext.Web.Tab();
tab.Title = m.mondi[i].nome;
tab.IconCls = "tabs";
tab.Closable = false;
tab.BodyStyle = "padding: 6px;";
foreach (ptipo pt in m.mondi[i].tipi.Values)
Coolite.Ext.Web.Button btn = new Coolite.Ext.Web.Button();
btn.Text = pt.nome;
btn.ToolTip = pt.descrizione;
btn.Visible = true;
tab.Frame = false;
bool b = tab.HasLayout();

Sep 24, 2008, 11:53 AM
Solved myself this way:

I Added a TableLayout to each Tab
On each TabLayout I added the different Buttons (in the Cells of the TableLayout)
I enabled TabPanel.LayoutOnTabChange to ensure visual update when Tab is changed

hope this is the correct way to do it.

Sep 24, 2008, 12:06 PM
The <ext:TableLayout> is a perfect solution.

Unfortunately the <ext:Button> is currently rendered as a "block" level element which is what's forcing them into individual rows when they're just rendered straight onto the Page (or controls collection).

Using a <table> and tweaking the css would work, although using an <ext:TableLayout> is the best solution.