2011-02-16 63 views
0

系统菜单项,我有以下代码隐藏在ExtJS的

var menus = Ext.air.SystemMenu; 

    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 
    ]); 

,我想隐藏“导入” item.I一直以API为3.3.0版本,并没有隐藏方法Ext.air.SystemMenu类。如何隐藏它?

回答

1

给你导入菜单按钮的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(); 
     }); 
    } 
} 

在源代码中存在对visbility的方法(这只是禁用按钮):

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

所以,你只需要调用此按钮上的方法:

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

看起来像它没有提供完全隐藏它的方法,但setVisible方法只会禁用它。

+0

在api中,我发现这种方法禁用:true或false – Gandalf 2011-02-16 15:13:35