1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    3
    Vote Rating
    1
    gemerson is on a distinguished road

      1  

    Default Answered: Menu not available in panel items array

    Answered: Menu not available in panel items array


    I'm creating a menu within a tree panel (code below) config but can't query for it. I checked the items array and alll it contained was a tree view. How a can the menu be created? Thanks.


    Code:
    Ext.define('MyApp.view.ProjectsPanel', {
        extend: 'Ext.tree.Panel',
        alias: 'widget.projectsPanel',
    
    
        autoRender: true,
        autoShow: true,
        width: 200,
        resizable: true,
        title: 'Projects',
        store: 'ProjectsCollection',
        displayField: 'label',
    
    
        initComponent: function() {
            var me = this;
    
    
            Ext.applyIf(me, {
                viewConfig: {
    
    
                },
                items: [
                    {
                        xtype: 'menu',
                        floating: true,
                        itemId: 'folder-click-menu',
                        width: 120,
                        items: [
                            {
                                xtype: 'menuitem',
                                text: 'New',
                                listeners: {
                                    click: {
                                        fn: me.onMenuitemClick,
                                        scope: me
                                    }
                                }
                            },
                            {
                                xtype: 'menuitem',
                                text: 'Delete'
                            }
                        ]
                    }
                ],
                listeners: {
                    beforerender: {
                        fn: me.onTreepanelBeforeRender,
                        scope: me
                    }
                }
            });
    
    
            me.callParent(arguments);
        },
    
    
        onMenuitemClick: function(item, e, options) {
            var projectCreationDialog = 
            Ext.create('MyApp.view.NewProjectsNodeForm');
            projectCreationDialog.show();
        },
    
    
        onTreepanelBeforeRender: function(abstractcomponent, options) {
            abstractcomponent.store.load();
        }
    
    
    });

  2. The menu shouldn't be an item, you should create the instance, save it as a property and hide/show it. REmember on destroy you need to destroy the menu.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,669
    Answers
    3354
    Vote Rating
    747
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    The menu shouldn't be an item, you should create the instance, save it as a property and hide/show it. REmember on destroy you need to destroy the menu.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Nov 2012
    Posts
    3
    Vote Rating
    1
    gemerson is on a distinguished road

      0  

    Default


    Fair enough. In the future, maybe Architect should disallow dragging a menu into a panel. Thanks.

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar