Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Ext.menu.Adapter

  1. #1
    Ext User
    Join Date
    Sep 2007
    Posts
    29

    Default Ext.menu.Adapter

    Hi,

    I need to add a grid to a menu. I can't open document for 'Ext.menu.Adapter'. Please help me find the right link to it.

    Thanks,
    knt

  2. #2
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    You don't need it. It's removed in Ext 3. Menu is a Container. It can contain Components.

  3. #3
    Ext User
    Join Date
    Sep 2007
    Posts
    29

    Default

    You're right. I should read the doc before asking. Thanks.

  4. #4
    Ext User
    Join Date
    Sep 2007
    Posts
    29

    Default Grid doesn't show

    Hi Again,

    I'm not able to see my grid after I add to menu item. I try adding other component like button/panel and it is okay. I put some log messages and I can see them but my grid doesn't render at all. I even try to load the ext grid sample (not my grid version) but it is not displayed too. What could be wrong here? The problem is I'm not getting any error so I have no clue.

    Thanks

  5. #5
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    Show some code. Or create a little testcase with a 1 row, 1 column grid in a menu which we can look at.

  6. #6
    Ext User
    Join Date
    Sep 2007
    Posts
    29

    Default

    Here it is. I can see the panel but no grid inside.

    var myData = [
    ['3m Co',71.72,0.02,0.03,'9/1 12:00am']
    ]

    // create the data store
    var store = new Ext.data.ArrayStore({
    fields: [
    {name: 'company'}
    ]
    });

    // manually load local data
    store.loadData(myData);

    // create the Grid
    var testgrid = new Ext.grid.GridPanel({
    store: store,
    columns: [
    {id:'company',header: 'Company', width: 160, sortable: true, dataIndex: 'company'}
    ],
    height: 100,
    width: 200,
    title: 'Array Grid'
    });


    secObj._srmenu = new Ext.menu.Menu({
    id:'srmenu',
    items: [
    new Ext.Panel({
    width:300,
    height:260,
    items:[testgrid]
    })]
    });

    secObj._srmenu.show(Ext.fly(obj), 'bl');

  7. #7
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    Why wrap the GridPanel with another unsized, no layout Panel????

  8. #8
    Ext User
    Join Date
    Sep 2007
    Posts
    29

    Default

    Sorry I remove the panel as part of my testing so it will have only the grid. I add layout:'fit' to the menu container still no grid.

    secObj._srmenu = new Ext.menu.Menu({
    id:'srmenu',
    layout:'fit',
    items: [
    testgrid
    ]
    });

  9. #9
    Ext User
    Join Date
    Sep 2007
    Posts
    29

    Default

    I finally figure it out it's not the menu problem. The menu and grid are created but they're hidden. It has to do with the way I show the menu. Thanks.

  10. #10
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    This works for me:

    Code:
        var myData = [
            ['3m Co',71.72,0.02,0.03,'9/1 12:00am']
        ]
    
        // create the data store
        var store = new Ext.data.ArrayStore({
            fields: [
               {name: 'company'}
            ]
        });
    
        // manually load local data
        store.loadData(myData);
    
        // create the Grid
        var testgrid = new Ext.grid.GridPanel({
            store: store,
            columns: [
                {id:'company',header: 'Company', width: 160, sortable: true, dataIndex: 'company'}
            ],
            height: 100,
            width: 200,
            title: 'Array Grid'
        });
    
    
        var myMenu = new Ext.menu.Menu({
            id: 'srmenu',
            items: testgrid
        });
    
        myMenu.showAt([0,0]);

Page 1 of 2 12 LastLast

Posting Permissions

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