[CLOSED] Layout setActiveItem() replacement?

  1. #1

    [CLOSED] Layout setActiveItem() replacement?

    Hi,

    I have the following v1.x code related to a Panel named PanelExplorer with AccordionLayout set:

    PanelExplorer.layout.setActiveItem(App.MenuPanelFile);
    PanelExplorer.items.each(function (item) {{
                                         if (item.menu.rendered) {{
                                              item.clearSelection();
                                         }}
    }});
    var menuId=getMenuId(); // Get a valid menu ID
    PanelExplorer.getComponent('MenuPanelFile').setSelection(menuId);
    Aside from prefixing the objects with App, what changes are due for it to work in v2.2? The layout property is now string but getLayout() method is missing from the panel instance.
    Last edited by Daniil; May 02, 2013 at 11:35 AM. Reason: [CLOSED]
  2. #2
    getLayout method is available
    http://docs.sencha.com/extjs/4.2.0/#...thod-getLayout

    Please provide runable sample reproduces the issue
  3. #3
    Hi Vladimir,

    Please run the code sample below. Click on the "Test Layout" button to reproduce. Please advise what goes wrong here.

    Quick Update: Sorry, this sample runs fine, I'm not sure what the difference between this code and mine so far. I will try to investigate.

    Another update:
    OK, it seems that App.PanelExplorer.getLayout() is there but it doesn't have the setActiveItem() method defined.

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html>
    
    <html>
    <head id="Head1" runat="server">
        <title>AccordionLayout in Markup - Ext.NET Examples</title>
        <script type="text/javascript">
            var testLayoutClick = function () {
                try {
                    Ext.Msg.alert("Layout is defined: ", App.PanelExplorer.getLayout());
                }
                catch (e) {
                    Ext.Msg.alert("Error", e.message);
                }
            };
    
        </script>
    </head>
    <body>
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <ext:Viewport ID="Viewport1" runat="server" Layout="BorderLayout">
            <Items>
                <ext:Panel ID="PanelExplorer"
                    runat="server"
                    Title="Accordion"
                    Width="250"
                    Maximizable="true"
                    BodyBorder="0"
                    Region="West"
                    Icon="ApplicationTileVertical"
                    Layout="AccordionLayout">
                    <TopBar>
                        <ext:Toolbar ID="Toolbar1" runat="server">
                            <Items>
                                <ext:Button ID="Button4" runat="server" Text="Test Layout">
                                    <Listeners>
                                        <Click Handler="testLayoutClick();"></Click>
                                    </Listeners>
                                </ext:Button>
                            </Items>
                        </ext:Toolbar>
                    </TopBar>
                    <Items>
                        <ext:TreePanel ID="TreePanel1" runat="server" Title="Online Users" RootVisible="false">
                            <Tools>
                                <ext:Tool Type="Refresh" />
                            </Tools>
                            <Root>
                                <ext:Node Text="Root">
                                    <Children>
                                        <ext:Node Text="Friends" Expanded="true">
                                            <Children>
                                                <ext:Node Text="Jack" Icon="User" Leaf="True" />
                                                <ext:Node Text="Brian" Icon="User" Leaf="True" />
                                                <ext:Node Text="Jon" Icon="User" Leaf="True" />
                                                <ext:Node Text="Tim" Icon="User" Leaf="True" />
                                                <ext:Node Text="Nige" Icon="User" Leaf="True" />
                                                <ext:Node Text="Fred" Icon="User" Leaf="True" />
                                                <ext:Node Text="Bob" Icon="User" Leaf="True" />
                                            </Children>
                                        </ext:Node>
                                        <ext:Node Text="Family" Expanded="true">
                                            <Children>
                                                <ext:Node Text="Kelly" Icon="UserFemale" Leaf="True" />
                                                <ext:Node Text="Sara" Icon="UserFemale" Leaf="True" />
                                                <ext:Node Text="Zack" Icon="UserGreen" Leaf="True" />
                                                <ext:Node Text="John" Icon="UserGreen" Leaf="True" />
                                            </Children>
                                        </ext:Node>
                                    </Children>
                                </ext:Node>
                            </Root>
                        </ext:TreePanel>
                        <ext:Panel ID="Panel1" runat="server" Title="Settings" />
                        <ext:Panel ID="Panel2" runat="server" Title="Even More Stuff" />
                        <ext:Panel ID="Panel3" runat="server" Title="My Stuff" />
                    </Items>
                </ext:Panel>
            </Items>
        </ext:Viewport>
    </body>
    </html>
    Last edited by vadym.f; Apr 30, 2013 at 7:17 PM.
  4. #4
    Yes, Accordion layout has no setActiveItem method, please its members
    http://docs.sencha.com/extjs/4.2.0/#...iner.Accordion

    To make an item as active please expand required item
    App.PanelExplorer.get(1).expand();
    or

    App.Panel1.expand();
  5. #5
    Thanks Vladimir!

    Will this approach work to select a menu item?

    App.PanelExplorer.getComponent('MenuPanelFile').setSelection(menuId);
  6. #6
    You should pass a menu item instance, not its id.
    App.PanelExplorer.getComponent('MenuPanelFile').setSelection(App.MenuItem1);
    This should work as well.
    App.PanelExplorer.getComponent('MenuPanelFile').setSelection(App["menuItemId"]);
  7. #7
    Thanks Daniil,

    Please close this thread down.

Similar Threads

  1. [CLOSED] Ext.Net.BoxComponent replacement in Ext.NET 2.1?
    By sisa in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Jan 23, 2013, 1:51 PM
  2. Replies: 1
    Last Post: Aug 21, 2012, 7:37 AM
  3. AddLabelCls replacement
    By Zdenek in forum 2.x Help
    Replies: 2
    Last Post: Aug 16, 2012, 5:08 PM
  4. Replies: 2
    Last Post: Jun 21, 2012, 6:05 PM
  5. Replies: 1
    Last Post: Jan 20, 2010, 6:08 AM

Tags for this Thread

Posting Permissions