2011-04-27 45 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