Click a Menu:menuitem from a different panel

  1. #1

    Click a Menu:menuitem from a different panel

    Hi All,

    I am using a variant of the dashboard from the Ext.net MVC site. I need to click a accordian menuitem from
    a dasboard dataview image as the image capture shows.

    <ext:MenuPanel ID="ConfigurationMenuPanel" runat="server" Border="false" SaveSelection="false" Cls="white-menu">
        <Menu ID="ConfigurationMenu" runat="server" AutoScroll="true" AutoHeight="true">
            <Items>
                <ext:MenuItem  ID="BusinessModelListMenuItem" runat="server" Text="Business Models" Icon="Bricks" >
                    <CustomConfig>
                        <ext:ConfigItem Name="url" Value="/Configuration/BusinessModelList/" Mode="Value" />
                    </CustomConfig>
                </ext:MenuItem >            
                <ext:MenuItem  ID="BankAccountInstancesDefinitionMenuItem" runat="server" Text="Bank Account Instances" Icon="Money" >
                    <CustomConfig>
                        <ext:ConfigItem Name="url" Value="/Configuration/BankAccountInstances/" Mode="Value" />
                    </CustomConfig>
                </ext:MenuItem >            
            </Items>
            <Listeners>
                <Click Handler="STSFinancialBrowser_addTab({ tabView: '#{tpMainPanel}', title: menuItem.text, url: menuItem.url, icon: menuItem.iconCls, passParentSize: menuItem.passParentSize});" />
            </Listeners>
        </Menu>                    
    </ext:MenuPanel>

    The 1.x funcitionality worked as javascript example below shows. The dataview javascript is shown below.
    The node[0].getAttibutes method find the master page's accordion panel menu. it then fires an itemclick
    event to the Menu Click handler. This instatiates the creation of a tab strip.

    var selectionChanged = function(dv, nodes) {
        if (nodes.length > 0) {
            var panel = nodes[0].getAttribute('ext:panel');
            var menu = nodes[0].getAttribute('ext:menu');
    
            if (!Ext.isEmpty(panel, false)) {
                parent.window[panel].expand();
            }
            if (!Ext.isEmpty(menu, false)) {
                parent.window[menu].parentMenu.fireEvent("itemclick", parent.window[menu]);
            }
        }
    }
    
    var viewClick = function(dv, e) {
        var group = e.getTarget('h2', 3, true);
        if (group) {
            group.up('div').toggleClass('collapsed');
        }
    }
    The 2.x funcitionality dataview javascript is different as shown below.

    var itemClick = function (view, record, item, index, e) {
        var group = e.getTarget("h2", 3, true);
    
        if (group) {
            group.up("div").toggleCls("collapsed");
            return false;
        }
        var item = e.getTarget(".item-wrap");
        if (item) {
            var panel = item.getAttribute('ext:panel');
            var menu = item.getAttribute('ext:menu');
    
            if (!Ext.isEmpty(panel, false)) {
                parent.window[panel].expand();
            }
    
            if (!Ext.isEmpty(menu, false)) {
                parent.window[menu].parentMenu.fireEvent("click", parent.window[menu]);
            }
        }
    }
    What doesn't work is the
    parent.window[menu].parentMenu.fireEvent("click", parent.window[menu]);
    code.
    The DOM objects are correct. The Menu object fires the event but the click handler doesn't get it.
    Attached Thumbnails Click image for larger version. 

Name:	Dashboard.png 
Views:	170 
Size:	54.4 KB 
ID:	4815  
    Last edited by Daniil; Sep 24, 2012 at 7:27 AM. Reason: Please use [CODE] tags
  2. #2
    For Ext.net 2.2 :

    REMOVE(NOT WORK)

    parent.window[panel].expand();
    Change:
    parent.window[menu].parentMenu.fireEvent("click", parent.window[menu]);
    By:
    parent.Ext.getCmp(menu).parentMenu.fireEvent("click", parent.Ext.getCmp(menu).parentMenu, parent.Ext.getCmp(menu));

Similar Threads

  1. MenuItem and Menu StartMenu
    By sysmo in forum 2.x Help
    Replies: 0
    Last Post: Sep 12, 2012, 8:32 PM
  2. Replies: 0
    Last Post: Mar 19, 2012, 7:26 AM
  3. How to get parent menuItem when click menuItem?
    By zhangsir199 in forum 1.x Help
    Replies: 2
    Last Post: Jan 21, 2011, 2:58 AM
  4. Replies: 2
    Last Post: Oct 22, 2010, 11:04 AM
  5. Replies: 1
    Last Post: Aug 31, 2009, 8:43 AM

Tags for this Thread

Posting Permissions