[CLOSED] FieldDefaults inheritance

  1. #1

    [CLOSED] FieldDefaults inheritance

    Below is a simple Window with FieldContainer(s). I was trying to understand how FieldDefaults are inherited. I would have assumed that the second FieldContainer would have inherited the FieldDefaults but it didn't. Is something wrong? If I uncomment the additional FieldDefaults in the 2nd container everything is displayed properly.

    Based on Sencha Documentation for FieldContainer:
    Like regular fields, FieldContainer can inherit its decoration configuration from the fieldDefaults of an enclosing FormPanel. In addition, FieldContainer itself can pass fieldDefaults to any fields it may itself contain.
    <%@ 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 id="Head1" runat="server">
        <title>Field Default Samples</title>
    </head>
    <body>
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <ext:Window runat="server" Width="500" BodyPadding="5">
            <Items>
                <ext:FormPanel runat="server" Border="false">
                    <FieldDefaults LabelAlign="Right" LabelWidth="90" />
                    <Items>
                        <ext:FieldSet ID="FieldSet1" runat="server" Title="General" Collapsible="true" Collapsed="false">
                            <Items>
                                <ext:FieldContainer runat="server" FieldLabel="Name" Layout="HBoxLayout">
                                    <FieldDefaults HideLabel="true" />
                                    <Items>
                                        <ext:TextField runat="server" EmptyText="First" Flex="1" FieldLabel="First Name" />
                                        <ext:TextField runat="server" EmptyText="Last" Flex="2" FieldLabel="Last Name" />
                                    </Items>
                                </ext:FieldContainer>
                                <ext:FieldContainer runat="server" Layout="HBoxLayout">
                                        <%-- <FieldDefaults LabelAlign="Right" LabelWidth="90" />
                                        --%>                                
                                    <Items>
                                        <ext:TextField runat="server" EmptyText="First" Flex="1" FieldLabel="First Name" />
                                        <ext:TextField runat="server" EmptyText="Last" Flex="2" FieldLabel="Last Name" />
                                    </Items>
                                </ext:FieldContainer>
                                <ext:TextArea runat="server" FieldLabel="Text Area" AnchorHorizontal="100%" />
                            </Items>
                        </ext:FieldSet>
                    </Items>
                </ext:FormPanel>
            </Items>
        </ext:Window>
    </body>
    </html>
    Attached Thumbnails Click image for larger version. 

Name:	FieldDefaults01.JPG 
Views:	44 
Size:	15.0 KB 
ID:	4805   Click image for larger version. 

Name:	FieldDefaults02.JPG 
Views:	38 
Size:	23.8 KB 
ID:	4806  
    Last edited by Daniil; Sep 20, 2012 at 5:32 PM. Reason: [CLOSED]
  2. #2
    Hi Chris,

    The quote fro the docs means that FormPanel FieldDefaults affects on FieldContainer as well as it affects on common fields.

    For example, FieldContainer LabelWidth will be 90 and it will be right aligned.

    Example
    <ext:FormPanel runat="server" Width="500">
        <FieldDefaults LabelAlign="Right" LabelWidth="90" />
        <Items>
            <ext:FieldContainer runat="server" FieldLabel="Name" Layout="HBoxLayout" />
        </Items>
    </ext:FormPanel>
    The second sentence means that FieldContainer supports the FieldDefaults setting for its items.

    So, it doesn't mean that FieldContainer copies FieldDefaults of its container. But I agree it sounds a bit ambiguous.

    You should apply the same FieldDefaults for FieldContainers if needed.
  3. #3
    Got it. I understand now. I just wanted to make sure I wasn't over defining my sub-controls if it was suppose to inherit attributes. Please close the thread.

Similar Threads

  1. [CLOSED] V2.1 FieldContainer & FieldDefaults
    By Aurelio in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 14, 2012, 4:27 PM
  2. Yet about inheritance
    By greydmar in forum 1.x Help
    Replies: 0
    Last Post: Jun 24, 2009, 9:13 AM
  3. Inheritance: Modifications to provide a complete extension
    By greydmar in forum Open Discussions
    Replies: 0
    Last Post: Jun 15, 2009, 9:40 AM
  4. Problem with inheritance
    By dbassett74 in forum 1.x Help
    Replies: 1
    Last Post: Apr 22, 2009, 12:34 PM
  5. FormLayout LabelStyle Inheritance
    By jlertle in forum 1.x Help
    Replies: 1
    Last Post: Nov 30, 2008, 2:22 PM

Tags for this Thread

Posting Permissions