[CLOSED] How To set FitHeight=true for Columnlayout on codebehind?

  1. #1

    [CLOSED] How To set FitHeight=true for Columnlayout on codebehind?

    Hi,

    I'm in the process of migrating to EXT.Net 5, but I'm struggling to know how to set FItHeigth = true on a ColumnLayout, in older versions This was a property of the columLayout, but I do not find what is the equivalent on EXT.Net 5 as it does not appear as an option on ColumLayoutConfig

    ViewPort vp = new ViewPort();
    vp.Layout="ColumnLayout";
    //these 2 lines does not seem to make the trick
    ColumnLayoutConfig clcfg=new ColumnLayoutConfig();
    clcfg.ConfigOptions.Add("FitHeigth",true,true);
    
    vp.LayoutConfig.Add(clcfg);
    Panel  mainPanel=GetMainPanel();
    vp.Items.Add(mainpanel);
    mainPanel.ColumnWidth=1;
    Panel btnsPanel=GetButtonsPanel();
    vp.Items.Add(btnsPanel);
    return vp;
    I'm sure that it is a simple thing, but I do not find out how to set it.

    Regards
    Last edited by fabricio.murta; Mar 13, 2020 at 10:58 PM. Reason: no feedback in over 7 days
  2. #2
    Hello @jcanton!

    You are migrating from Ext.NET 1 to 5, right?

    I see references to the config option you mentioned (FitHeight) in the ColumnLayout Example from Ext.NET 1 examples explorer.

    It seems the column layout lost that feature since 1 to 2 version upgrade. If you searched forums, you'd see a few threads about situations where it didn't work well still in version 1; and that might have been the reason it couldn't survive version 2 of Ext.NET.

    Good news is that you have more than one different ways to reproduce the same layout with other approaches.

    From the example in Version 1, I could attain the same visual result if I changed the layout to BorderLayout; in case you are also using three columns, this should work for you.

    From the example linked above, I could get this equivalent in version 5:

    <%@ Page Language="C#" %>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Column Layout - Ext.NET Examples</title>
        <link href="/resources/css/examples.css" rel="stylesheet" />
    </head>
    <body>
        <ext:ResourceManager runat="server" />
    
        <ext:Viewport runat="server" Layout="BorderLayout">
            <Items>
                <ext:Panel
                    runat="server"
                    Flex="1"
                    Region="West"
                    Title="Width=0.25"
                    Html="This is some content."
                    />
                <ext:Panel
                    runat="server"
                    Flex="3"
                    Region="Center"
                    Title="Width=0.75"
                    Html="This is some content."
                    />
                <ext:Panel
                    runat="server"
                    Title="Width=250px"
                    Region="East"
                    Width="250"
                    Html="This is some content."
                    />
            </Items>
        </ext:Viewport>
    </body>
    </html>
    This will basically work if you have just three columns in whatever container you are placing the items (viewport, panel, container).

    In case you have an arbitrary amount of columns, you might want to use the HBox layout instead. It supports the same "flex" weight as above. Just instead of being a float, you'd use an int. In the original example, we had 0.25 and 0.75 as ColumnWidth; this translates to 1 and 3 in Flex "language".

    There's a topic of particular interest for your question, which we recommended to use HBoxLayout, here: ColumnLayout and FitHeight.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Thanks,

    I'll change the layout.

    Actually I'm migrating 1.x and 3.x code. This option was also available in 3.x. But there is no problem I can change to other layout.

    Regards.
  4. #4
    Hello,

    The following suggests the setting was no longer available since version 2 of Ext.NET:

    - ColumnLayout example in v1
    - ColumnLayout example in v2

    If you look both examples' source code, you'll notice the newer version no longer uses any reference to the FitHeight keyword.

    So I believe you could probably have kept the property set in the ASPX code for version 3, it would actually be brought out to client-side, but had no effect to the built page. You would suffer the same code behind issue if you tried to use it in Ext.NET 3 code.

    Regardless of that, the last post remains your best choice to keep a consistent layout. Ext.NET 1 suffered the most breaking changes (between versions 1 and 2), since the code was still being consolidated. From between v2 to v3 to v4 to v5, a much smaller set of structural changes took place and migration should be much easier if compared to v1.

    Hope this helps, and count on us if you need further help in the migration process!
    Last edited by fabricio.murta; Jan 24, 2020 at 5:00 PM. Reason: properly close URL block.
  5. #5
    Hello @jcanton!

    Did changing the layout work for you in the problem, or do you still need assistance with this issue? I'm sorry this lost setting caused you some headache in the migration, but there been long discussions about this and there were some technology boulders preventing it from being feasible, exactly for layout issues, especially as responsive layouts became a thing.

    We may mark this thread as closed if you don't post back in 7+ days from now, but falter not, as we don't lock up threads, you will still be able to post here even after the 'closed' tag is in place and we can continue the discussion.

    Looking forward to your feedback!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 4
    Last Post: Dec 30, 2014, 10:44 AM
  2. Replies: 0
    Last Post: Jun 12, 2014, 6:27 AM
  3. Set AllowBlank Property True Dynamically in codebehind
    By prerakbhandari in forum 2.x Help
    Replies: 0
    Last Post: Jan 21, 2013, 7:39 AM
  4. [CLOSED] ColumnLayout and FitHeight
    By thchuong in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 21, 2013, 6:10 AM
  5. [CLOSED] FitHeight for panel
    By Suntico in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Apr 28, 2011, 4:26 PM

Posting Permissions