PDA

View Full Version : [CLOSED] Auto Width Panel inside TabPanel



xeo4.it
Oct 05, 2012, 1:42 PM
Hi,
I don't succeed in making an auto width panel inside tabpanel, in my example the panel pnlTest takes the width on the parent and I want that takes the width of the child label.
Please help me.

Thank you very much

Jimmy



<%@ Page Language="C#" %>


<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>


<!DOCTYPE html>


<html>
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:TabPanel ID="TabPanel1" runat="server" Height="500">
<Items>
<ext:Panel ID="Panel1"
runat="server"
Title="Tab"
>
<Items>
<ext:Panel ID="pnlTest" runat="server" Title="test" X="20" Y="30" >
<Items>
<ext:Label ID="lbl" runat="server" Text="test" ></ext:Label>
</Items>
</ext:Panel>
</Items>
</ext:Panel>
</Items>
</ext:TabPanel>
</form>
</body>
</html>

Daniil
Oct 05, 2012, 2:50 PM
Hi @xeo4.it,

Maybe something like this.

<ext:Panel runat="server">
<Items>
<ext:Label runat="server" Text="test">
<Listeners>
<AfterRender Handler="this.up('panel').setWidth(this.getWidth());" />
</Listeners>
</ext:Label>
</Items>
</ext:Panel>

xeo4.it
Oct 05, 2012, 4:02 PM
Hi Danil,
the problem is that the panel not auto size, in the ext.net 1.x the panel size suited him for its content, without I did nothing.

Jimmy

Daniil
Oct 08, 2012, 8:54 AM
Hi Jimmy,

I tried your sample in v1 - the Panel stretches up to the screen width the same way as it is in v2.

Could you provide a sample for v1?

xeo4.it
Oct 08, 2012, 1:40 PM
Hi Daniil,
I have made the example in v1:



<%@ Page Language="C#" %>


<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ScriptManager1" runat="server" >
</ext:ResourceManager>


<ext:TabPanel ID="tabPnl" Plain="true" TabPosition="Top" runat="server" Border="false" Height="500">
<Items>
<ext:Panel ID="test" runat="server" Border="false" Title="Tab 1" Closable="true" X="0" Y="0" >
<Items>
<ext:Panel ID="pnlTest" runat="server" Border="true" Title="test" BoxMinHeight="0" Frame="true" X="50" Y="30" Floating="true" >
<Items>
<ext:TableLayout ID="tbl" runat="server" Columnbs="1">
<Cells>
<ext:Cell>
<ext:Label ID="lblTest" runat="server" Text="Test one"></ext:Label>
</ext:Cell>
</Cells>
</ext:TableLayout>
</Items>
</ext:Panel>
</Items>
</ext:Panel>
</Items>
</ext:TabPanel>
</form>
</body>
</html>


The difference is that the panel "pnlTest" has Floating property set to true, but if I set the property floating to true in v2 the panel doesn't show.
Please help me.

Thank you very much.

Daniil
Oct 08, 2012, 2:10 PM
Thank you for the sample.

Well, it looks a hack and I was surprised that it works as you need.

Please use the solution from the post #2. It should work well and be stable.

xeo4.it
Oct 08, 2012, 3:42 PM
Hi Daniil,
ok, I will use the solution of post #2.

Thank you

Jimmy