Results 1 to 3 of 3

Thread: Context menu showing on window instead of grid on 4.2.0

  1. #1
    Sencha User
    Join Date
    Oct 2009
    Posts
    68
    Answers
    2

    Default Answered: Context menu showing on window instead of grid on 4.2.0

    I have grid on window. I add context menu to grid. But context menu showing under grid

    Code:
    Ext.define('Ext.ux.desktop.Grid', {
        extend: 'Ext.grid.Panel',
    
    
        requires: [
            'Ext.ux.desktop.SearchField',
            'Ext.toolbar.Paging'
        ],
    
    
        width: '100%',
    
    
        height: '100%',
    
    
        stripeRows: true,
        
        listeners: {
                itemcontextmenu: function (view, record, item, index, e) {
                    e.stopEvent();
                    var selModel = this.getSelectionModel();
                    if (selModel instanceof Ext.selection.RowModel) {
                        if (!selModel.isSelected(record)) {
                            selModel.select(record);
                        }
                        this.fireEvent('itemclick', this, record, item, index, e);
                        this.contextMenu.showAt(e.getXY());
                    }
                }
        },
    
    
        initComponent: function () {
            var me = this;       
            me.contextMenu = Ext.create('Ext.menu.Menu', { items: [{ text: 'O?uz' }, {text:'Trkan'}] });
            ....
    }

  2. The below example works ok for me. Are you seeing it work ok for you, too?

    Code:
    Ext.create('Ext.data.Store', {
        storeId:'simpsonsStore',
        fields:['name', 'email', 'phone'],
        data:{'items':[
            { 'name': 'Lisa',  "email":"[email protected]",  "phone":"555-111-1224"  },
            { 'name': 'Bart',  "email":"[email protected]",  "phone":"555-222-1234" },
            { 'name': 'Homer', "email":"[email protected]",  "phone":"555-222-1244"  },
            { 'name': 'Marge', "email":"[email protected]", "phone":"555-222-1254"  }
        ]},
        proxy: {
            type: 'memory',
            reader: {
                type: 'json',
                root: 'items'
            }
        }
    });
    
    
    Ext.create('Ext.grid.Panel', {
        title: 'Simpsons',
        store: Ext.data.StoreManager.lookup('simpsonsStore'),
        columns: [
            { text: 'Name',  dataIndex: 'name' },
            { text: 'Email', dataIndex: 'email', flex: 1 },
            { text: 'Phone', dataIndex: 'phone' }
        ],
        height: 200,
        width: 400,
        renderTo: Ext.getBody(),
        myMenu: Ext.widget('menu', {
            items: [{ text: 'First Menu Item' }]
        }),
        listeners: {
            itemcontextmenu: function (view, record, item, index, e) {
                e.stopEvent();
                view.ownerCt.myMenu.showAt(e.getXY());
            }
        }
    });

  3. #2
    Sencha User slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,165
    Answers
    505

    Default

    The below example works ok for me. Are you seeing it work ok for you, too?

    Code:
    Ext.create('Ext.data.Store', {
        storeId:'simpsonsStore',
        fields:['name', 'email', 'phone'],
        data:{'items':[
            { 'name': 'Lisa',  "email":"[email protected]",  "phone":"555-111-1224"  },
            { 'name': 'Bart',  "email":"[email protected]",  "phone":"555-222-1234" },
            { 'name': 'Homer', "email":"[email protected]",  "phone":"555-222-1244"  },
            { 'name': 'Marge', "email":"[email protected]", "phone":"555-222-1254"  }
        ]},
        proxy: {
            type: 'memory',
            reader: {
                type: 'json',
                root: 'items'
            }
        }
    });
    
    
    Ext.create('Ext.grid.Panel', {
        title: 'Simpsons',
        store: Ext.data.StoreManager.lookup('simpsonsStore'),
        columns: [
            { text: 'Name',  dataIndex: 'name' },
            { text: 'Email', dataIndex: 'email', flex: 1 },
            { text: 'Phone', dataIndex: 'phone' }
        ],
        height: 200,
        width: 400,
        renderTo: Ext.getBody(),
        myMenu: Ext.widget('menu', {
            items: [{ text: 'First Menu Item' }]
        }),
        listeners: {
            itemcontextmenu: function (view, record, item, index, e) {
                e.stopEvent();
                view.ownerCt.myMenu.showAt(e.getXY());
            }
        }
    });

  4. #3
    Sencha User
    Join Date
    Oct 2009
    Posts
    68
    Answers
    2

    Default

    thank you it's works

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •