PDA

View Full Version : [CLOSED] Problem label getWidth with Chrome



xeo4.it
May 06, 2013, 1:59 PM
Hi,
my following example works fine with IE and Firefox, but in Chrome the function getWidth() of the label return 0.
I need know the correct size of label to set the panel size.

Thank you



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

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>


<script runat="server">

protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack && !X.IsAjaxRequest)
{
Ext.Net.Label lbl = new Ext.Net.Label();
Ext.Net.Panel pnl = new Ext.Net.Panel();


pnl.StyleSpec = String.Format("position: absolute; z-index:3; ");

pnl.X = 100;
pnl.Y = 100;


lbl.Html = "<table><tr><td>prova</td><td>prova</td></tr></table>";

lbl.Listeners.AfterRender.Fn = "afterRenderLabel";

pnl.Items.Add(lbl);


this.pnlTest.Items.Add(pnl);

}
}

</script>


<script type="text/javascript">


var afterRenderLabel = function (lbl, eOpts) {


alert(lbl.getWidth());


if (lbl.up('panel') != null) {


lbl.up('panel').setWidth(lbl.getWidth());


lbl.up('panel').doLayout();
}


}


</script>

</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />

<ext:Panel ID="pnlTest" runat="server" Width="700" Height="450" >
<Items>

</Items>
</ext:Panel>


</form>
</body>
</html>

Vladimir
May 06, 2013, 2:23 PM
Well, placing html table inside table is not good solution because you place block element inside inline element
I suggest to replace Label by Container

xeo4.it
May 06, 2013, 5:03 PM
Hi Vladimir,
thank you, with Container works fine.

Jimmy