[CLOSED] FormLayout overrides the label width

  1. #1

    [CLOSED] FormLayout overrides the label width

    Hi,

    I've observed that setting Panel layout to "FormLayout" messes with its nested elements' label attributes. In the test case below, FieldContainer Label width seems to be superseded by the x-form-layout-auto-label class. Please refer to the image attached.

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <style>
        .read-only-label {
            color: #696969;
            border-width: 1px;
            border-style: double;
            border-color: #C6CBDA;
            height: 14px;
            background-color: #F2F6FB;
            text-overflow: ellipsis !important;
            white-space: nowrap !important;
            overflow: hidden !important;
            width: 100%;
        }
    </style>
    <!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 id="Head1" runat="server">
        <title>Ext.Net 2.x</title>
        <ext:ResourcePlaceHolder ID="ResourcePlaceHolder1" runat="server" Mode="Script" />
        <ext:ResourcePlaceHolder ID="ResourcePlaceHolder2" runat="server" Mode="Style" />
    </head>
    <body>
        <form id="Form1" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server">
            </ext:ResourceManager>
            <ext:Viewport runat="server" Layout="FitLayout">
                <Items>
                    <ext:Panel runat="server" Height="200" Layout="FormLayout">
                        <Items>
                            <ext:FieldContainer runat="server" FieldLabel="Name" LabelWidth="200" AnchorHorizontal="100%" Layout="HBoxLayout">
                                <Items>
                                    <ext:DisplayField runat="server" Width="280" Cls="read-only-label">
                                    </ext:DisplayField>
                                    <ext:ToolbarSpacer Width="30">
                                    </ext:ToolbarSpacer>
                                    <ext:DisplayField runat="server" Text="Title:" Width="80">
                                    </ext:DisplayField>
                                    <ext:DisplayField runat="server" Width="280" Cls="read-only-label">
                                    </ext:DisplayField>
                                </Items>
                            </ext:FieldContainer>
                        </Items>
                    </ext:Panel>
                </Items>
            </ext:Viewport>
        </form>
    </body>
    </html>
    Click image for larger version. 

Name:	26-08-2015 9-45-26 AM.png 
Views:	80 
Size:	40.7 KB 
ID:	24183
    Last edited by Daniil; Aug 26, 2015 at 4:16 PM. Reason: [CLOSED]
  2. #2
    Hi Vadym,

    I was surprised, but it is by design.
    http://docs.sencha.com/extjs/5.1/5.1...cfg-labelWidth

    I remember you are migrating from v1. FormLayout in v3 (maybe, since v2, I don't remember exactly) is not that it was in v1. It was simplified and it render form felds, one under the other all stretched to the container width. And it is not very configurable. For example, it doesn't take a field's AnchorHorizontal into account. AnchorLayout in v3 does the job that FormLayout does in v1. You might want to switch to AnchorLayout.
  3. #3
    Thanks for digging it out, Daniil. I've changed the type of Panel container to FormPanel removing the Layout attribute altogether (I believe a FormPanel utilizes FormLayout by default). All of a sudden, the LabelWidth property works as expected. It's those pesky styling incompatibilities and nuisances that have been giving us grief in migration :( You may close down this thread.
  4. #4
    A FormPanel's default layout is AnchorLayout. Agree, it might be confusing.

    It's those pesky styling incompatibilities and nuisances that have been giving us grief in migration :(
    Yeah, I understand:( ExtJS 4 (that leads to ExtJS 5) was a great rework of ExtJS 3. Unfortunately, it produced a lot of breaking changes. Especially, in minor details.

Similar Threads

  1. Replies: 1
    Last Post: Aug 21, 2013, 5:47 PM
  2. [CLOSED] width not set in FormLayout
    By idrissb in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 25, 2010, 8:39 PM
  3. ext:Label in FormLayout
    By mrozik in forum 1.x Help
    Replies: 8
    Last Post: Jul 27, 2009, 5:50 PM
  4. Replies: 1
    Last Post: Feb 03, 2009, 6:44 AM
  5. FormLayout with label above of input
    By pkngan in forum 1.x Help
    Replies: 0
    Last Post: Oct 29, 2008, 1:12 PM

Tags for this Thread

Posting Permissions