0
votes

I want to show only one GridPanel,which I dynamically add by switch click button event, in window.

var event_menu = new Ext.menu.Menu( {
    id : "event_menu",
    items : [ {
        text : 'record1',
        handler : function() {
            win.add(item_list_panel);//dynamica add GridPanel to show server data
            win.doLayout();
            item_list_store.load();
        }
    }, {
        text : 'record2',
        handler : function() {
                           win.remove(item_list_panel);//I want to remove it inorder to show the item_list_panel2 and only show one panel.
            win.add(item_list_panel2);
            win.doLayout();
            item_list_store.load();
        }
    } ]
});

and this menu belong to my window tbar. when I click record win will show item_list_panel and I want to when I click record2 the item_list_panel2 will show in win and item_list_panel will hide. If I win.remove(item_list_panel) will have an error :

c.getPositionEl().dom is undefined

How can I do it,Thanks

1

1 Answers

1
votes

I can barely understand your question, but if I understand correctly you can do it several ways.

you can destroy the component directly

item_list_panel.destroy()

you can go through your items and select it by id

win.items.item('item_id').destroy()

There are also ways to remove it without completely destroying it, depends what you want to do