2013-10-17 50 views
0

我新的ExtJS的,我已經發現了一些,這可能是一個愚蠢的問題,但在這裏它是ExtJS的隱藏href的值

var cntMenu = Ext.create('Ext.menu.Menu', { 
    items: [{ 
     text:"Articles", 
     iconCls: 'bmenu', 
     icon:'images/menu-images/s.gif', 
     handler: onItemClick, 
     data:'manage-post.php' 
    }] 
); 

生成以下代碼

<a class="x-menu-item-link" href="#" hidefocus="true" unselectable="on" id="ext-gen1227"> 
    <img src="images/menu-images/s.gif" class="x-menu-item-icon bmenu" id="ext-gen1228"> 
    <span class="x-menu-item-text" id="ext-gen1229">Articles</span> 
</a> 

我的問題href是如何顯示「#」的?點擊鏈接就像我點擊正常的PHP鏈接時一樣。

回答

1

你的意思是通常的html-link?您的按鈕不是鏈接。你必須在你的處理函數添加代碼,使由JavaScript的方式瀏覽:

onItemClick: function(button, event, opts){ 
    document.location.href ='your link'; // manage-post.php? 
} 

如果我理解正確的你。 或更短:

var cntMenu = Ext.create('Ext.menu.Menu', { 
    items: [{ 
     text:"Articles", 
     iconCls: 'bmenu', 
     icon:'images/menu-images/s.gif', 
     handler: function(button, event, opts){ 
      document.location.href ='your link'; // manage-post.php? 
     }, 
     data:'manage-post.php' 
    }] 
);