[OPEN] [#1297] [3.3.0 / 4.0.0-rc] Flex in FieldContainer with HBox-layout doesn't work

  1. #1

    [OPEN] [#1297] [3.3.0 / 4.0.0-rc] Flex in FieldContainer with HBox-layout doesn't work

    In the following example the TextField inside Field2 should be stretched to fit the width, but it doesn't happen:

        Html.X().Panel()
            .Layout(LayoutType.Form)
            .Items(
                
                Html.X().TextField()
                    .FieldLabel("Field1")
                ,
                Html.X().FieldContainer()
                    .FieldLabel("Field2")
                    .Layout(LayoutType.HBox)
                    .Items(
                        Html.X().TextField().Flex(1)
                    )
            )
    Last edited by fabricio.murta; Mar 29, 2016 at 4:31 AM.
  2. #2
    Hello! Thanks for reporting this problem!

    Seems that it has been a known issue in our underlying framework (Sencha ExtJS) for some time now. Details on the issue bound to this thread.

    I've just created an issue with a little more details on the problem under number #1297. As soon as we have this fixed we'll be updating here with the news!

    Thanks again!

    EDIT: Please, wrap code you paste in [code ] and [/code ] tags. It makes the post & code look so much more nicer, readable and also provides a handy 'copy to clipboard' button. We're looking forward for you editing the other post where you pasted code without the tags (no, we are not going to ignore it no matter what!).
    Last edited by fabricio.murta; Mar 29, 2016 at 4:33 AM.
    Fabrício Murta
    Developer & Support Expert
  3. #3
    I see Sencha haven't fixed this, although the issue is now 1.5 years old.

    Are there any workarounds? We'd like to upgrade from Ext.Net 2.5 to 4.1, but this is a major problem for us.
  4. #4
    Hello!

    Sencha does not seem to consider this a bug, although logged as one. They once stated that the form layout is intended only of fulfilling simple forms layouts. Whenever a form layout do not fit your needs, you have to fall over for the other available layouts.

    So I believe that a good workaround for this is actually falling over for other layouts to make your view fit correctly.
    Fabrício Murta
    Developer & Support Expert
  5. #5
    Hello Fabricio!

    We acquired the 4.1 license, despite this issue.

    Looking at this reply on the Sencha forums, I've used ShrinkWrap="Height" to improve the situation. However, there's still an empty space at the end of the field container. Any ideas?

    Here's a working example:

          <ext:ResourceManager runat="server" />
          <ext:Viewport ID="Viewport1" runat="server" Layout="BorderLayout">
             <Items>
                <ext:FormPanel ID="panelFilters" runat="server" AutoScroll="true" Region="Center" Title="SomeFilters" BodyPadding="5" MinWidth="400">
                   <LayoutConfig>
                      <ext:VBoxLayoutConfig Align="Stretch"></ext:VBoxLayoutConfig>
                   </LayoutConfig>
                   <FieldDefaults LabelWidth="140"></FieldDefaults>
                   <Items>
                <ext:FieldSet ID="criteriaGeneral" Collapsible="true" runat="server" Title="General" Layout="FormLayout">
                   <Items>
                      <ext:FieldContainer ID="FieldContainer1" runat="server" Layout="HBoxLayout" FieldLabel="Height" ShrinkWrap="Height">
                         <LayoutConfig>
                            <ext:HBoxLayoutConfig Align="Stretch"></ext:HBoxLayoutConfig>
                         </LayoutConfig>
                         <Items>
                            <ext:TextField ID="TextField1" runat="server" Flex="2"></ext:TextField>
                            <ext:TextField ID="TextField2" runat="server" Flex="3"></ext:TextField>
                            <ext:TextField ID="TextField3" runat="server" Flex="1"></ext:TextField>
                         </Items>
                      </ext:FieldContainer>
                      <ext:FieldContainer ID="FieldContainer2" runat="server" Layout="HBoxLayout" FieldLabel="Default">
                         <LayoutConfig>
                            <ext:HBoxLayoutConfig Align="Stretch"></ext:HBoxLayoutConfig>
                         </LayoutConfig>
                         <Items>
                            <ext:TextField ID="TextField4" runat="server" Flex="2"></ext:TextField>
                            <ext:TextField ID="TextField5" runat="server" Flex="3"></ext:TextField>
                            <ext:TextField ID="TextField6" runat="server" Flex="1"></ext:TextField>
                         </Items>
                      </ext:FieldContainer>
                   </Items>
                </ext:FieldSet>
                      </Items>
                   </ext:FormPanel>
             </Items>
          </ext:Viewport>
    Last edited by Edgar; Aug 30, 2016 at 10:14 AM.
  6. #6
    Hello!

    It probably is not what you want, but changing the layout on your line 10 to VBoxLayout fixes the issue. At least for the sample you provided. As for it to work in a FormLayout, will need some changes in the layout building algorythm which could in turn bring forth other problems we just can't assess at this point, without further investigation.

    EDIT: Changing your line 8's width to 70 seems to also address the issue. You may need to adjust the labelWidth to the fieldsets in order to allow the form to look right.
    Last edited by fabricio.murta; Aug 31, 2016 at 5:27 AM.
  7. #7
    Obrigado FabrÃ*cio!

    After some minor tweaks I managed to fix the page to display as in 2.5. Now on to the next 20 similar pages :)

Similar Threads

  1. Replies: 21
    Last Post: Apr 27, 2016, 2:40 AM
  2. Replies: 6
    Last Post: Apr 27, 2016, 12:56 AM
  3. [CLOSED] HBoxLayout doesn't work inside of FieldContainer
    By Svr77 in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: Apr 10, 2013, 7:57 PM
  4. Replies: 1
    Last Post: Mar 10, 2013, 3:00 PM
  5. Replies: 4
    Last Post: Feb 09, 2010, 6:14 PM

Posting Permissions