开发者

Hiding a system menu item in ExtJS

I have the following code

var menus = Ext.air.System开发者_StackOverflowMenu;

    menus.add('File', [
        actions.newTask, 
        actions.newList, 
        actions.newFolder, 
        '-',{
            text:'Import...',
            handler: function(){
                var importer = new tx.Importer();
                importer.doImport(function(){
                    tx.data.lists.load();
                    root.reload();
                    loadList('root');
                    Ext.Msg.hide();
                });
            }
        },{
            text:'Export...',
            handler: function(){
                new tx.Exporter();
            }
        },
        '-', 
        actions.quit
    ]);

and i want to hide the 'Import' item.I have been to the API for version 3.3.0 and there is no hide method for Ext.air.SystemMenu class.How should i hide it?.


give your import menu button an ID:

{
     text:'Import...',
     id: 'importBtn',
     handler: function(){
         var importer = new tx.Importer();
         importer.doImport(function(){
             tx.data.lists.load();
             root.reload();
             loadList('root');
             Ext.Msg.hide();
         });
     }
}

In the source code there is a method for visbility (which just disables the button):

 setVisible : function(v){
    // could not find way to hide in air so disable?
    nativeItem.enabled = !v;
 },

So you just have to call this method on the button:

Ext.getCmp('importBtn').setVisible(false);

Looks like it doesn't provide a method for completely hiding it though, as the setVisible method only disables it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜