2011-04-27 43 views
0

每當我創建一個帶有url的組件時,Ext Js 4將向鏈接添加?undefined。我怎樣才能擺脫這一點?EXT JS 4將查詢字符串添加到鏈接

Ext.onReady(function() { 
       Ext.create('Ext.toolbar.Toolbar', {"items":[{"text":"Dashboard","xtype":"button","target":"_self","href":"https:\/\/domain.tld\/admin\/"},{"text":"Categories","xtype":"button","menu":{"items":[{"text":"New","xtype":"button","target":"_self","href":"https:\/\/domain.tld\/admin\/category\/create\/"}]}}],"renderTo":"admin_menu","width":"100%"}); 
      }); 

點擊儀表盤把你帶到https://domain.tld/admin/dashboard?undefined

回答

1

我看了看源代碼,看看它是如何創建網址的。它需要href配置並附加params配置而不檢查是否定義了參數。然後追加baseParams配置。所以如果你想要一個沒有查詢字符串的鏈接,用一個空的params配置創建你的按鈕。 (「Ext.button.Button」,{href:'www.google.com',params:'',文本:'Link',target:'_ self'});}};

0

ExtJS documentation沒有提到href作爲工具欄支持的配置選項。

我建議指定一個處理函數,而不是指定targethref。東西的影響:


{ 
    text:'Dashboard', 
    handler:function(){ 
    //window.open(...) or window.location.href=... 
    } 
//... 
} 
+0

真正的文檔沒有提到它,但如果你看看配置,它的支持配置選項 – chris 2011-04-29 15:27:53