[FIXED] [#176] [2.x] GridPanel not collapsible when title set from code behind.

  1. #1

    [FIXED] [#176] [2.x] GridPanel not collapsible when title set from code behind.

    Hello!

    Please investigate the below code. When I set title for "Grid1" from code behind @Page_Load, it is not Collapsible anymore.

    Below changes make Grid1 collapsible:
    1) Removing title change code from Page_Load()
    or
    2) Moving Tab2 as the first tab in MyTabPanel items collection.
    or
    3) Replacing Grid1.SetTitle("Modified-Grid1") with Grid1.Title="Modified-Grid1".

    Is there a rational for number 2 and 3?

    Thanks.

    <%@ Page Language="C#" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                Grid1.SetTitle("Modified-Grid1");            
            }
        }
    
    </script>
    
    <!DOCTYPE html>
    <html>
    <head id="Head1" runat="server">
        <title>Ext.NET Examples</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server"/>
        <div>
        <ext:Viewport ID="MyViewport" runat="server" Layout="BorderLayout">
            <Items>
                <ext:TabPanel runat="server" ID="MyTabPanel" Layout="FitLayout" Region="Center">
                    <Items>                    
                        <ext:Panel runat="server" ID="Tab1" Title="Tab1" Layout="FitLayout"></ext:Panel>                                    
                        <ext:Panel runat="server" ID="Tab2" Title="Tab2" Layout="FitLayout" MaxHeight="300">
                            <Items>
                                <ext:GridPanel runat="server" ID="Grid1" Title="Grid1" Collapsible="true" CollapseDirection="Top"></ext:GridPanel>
                            </Items>              
                        </ext:Panel>                                                                            
                    </Items>
                </ext:TabPanel>             
            </Items>
        </ext:Viewport>    
        </div>
        </form>
    </body>
    </html>      
        </form>
    </body>
    </html>
    Last edited by fabricio.murta; Apr 26, 2016 at 10:50 PM.
  2. #2
    Hello!

    During initial PageLoad you should use Properties like Title, methods to set properties like SetTitle should be used only during DirectEvents and DirectMethods.
  3. #3
    Quote Originally Posted by Baidaly View Post
    Hello!

    During initial PageLoad you should use Properties like Title, methods to set properties like SetTitle should be used only during DirectEvents and DirectMethods.
    Hi,

    Thanks for prompt response. Okay, I learned not to use methods during page load. By the way, how do you explain #2? Is it because the tab is rendered after page load and not rendered when it is not the active tab in the original scenario?

    2) Moving Tab2 as the first tab in MyTabPanel items collection.
    Thanks.
  4. #4
    Yes, you are right.

    The SetTitle method generates this JavaScript.
    App.Grid1.setTitle("Modified-Grid1");
    And it executes when the page is just loaded. But yes, the GridPanel is not rendered yet, because it is in an inactive tab.

    By default, all inactive tabs are not rendered till the first activation.
  5. #5
    Quote Originally Posted by Daniil View Post
    Yes, you are right.

    The SetTitle method generates this JavaScript.
    App.Grid1.setTitle("Modified-Grid1");
    And it executes when the page is just loaded. But yes, the GridPanel is not rendered yet, because it is in an inactive tab.

    By default, all inactive tabs are not rendered till the first activation.
    Thank you Daniil. Please mark as closed.
    By the way I still do not understand why that difference make collapsible property go off.
  6. #6
    The setTitle method doesn't work well for a non-rendered panel.

    Well, I would consider it a bug.
    http://www.sencha.com/forum/showthread.php?258841
  7. #7
    Quote Originally Posted by Daniil View Post
    The setTitle method doesn't work well for a non-rendered panel.

    Well, I would consider it a bug.
    http://www.sencha.com/forum/showthread.php?258841
    OK. Thanks.
  8. #8
    Sencha opened a bug.

    We created an Issue to monitor.
    https://github.com/extnet/Ext.NET/issues/176
  9. #9
    Sencha issue reads as 'fixed' now, so seems recent Ext.NET versions are no longer affected by this issue!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 4
    Last Post: Apr 27, 2016, 1:16 AM
  2. [CLOSED] disabling rowexpander collapsible from code behind
    By redi in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Oct 10, 2014, 2:01 PM
  3. Collapsible list in a GridPanel row
    By AlexMaslakov in forum 1.x Help
    Replies: 3
    Last Post: Sep 13, 2011, 9:15 AM
  4. [CLOSED] Collapsible Panel title not showing after collapse.
    By rnachman in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: May 11, 2011, 5:02 PM
  5. Replies: 1
    Last Post: Sep 16, 2008, 10:45 AM

Posting Permissions