PDA

View Full Version : [CLOSED] Href property in splitbutton not working?



blueworld
Aug 05, 2013, 1:35 PM
Hi,

in my democode nothing happens if I click the splitbutton, but if I do a right-click on the splitbutton, showing me link Options, like "Open this link in a new tab", and that does work.

Furthermore, I think that a click on the splitter-arrow would also cause a redirect, and thats not what should happen.



<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<script runat="server">

</script>

<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<title>Ext.NET v2 Example</title>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:FormPanel runat="server">
<Items>
<ext:Toolbar>
<Items>
<ext:SplitButton Text="Splitbutton" Href="http://www.ext.net" HrefTarget="_blank" ID="SplitButton1" runat="server">
<Menu>
<ext:Menu>
<Items>
<ext:MenuItem Text="Button 1" Href="http://www.ext.net" HrefTarget="_blank" id="MenuItem1" runat="server">
</ext:MenuItem>
<ext:MenuItem Text="Button 2">

</ext:MenuItem>
</Items>
</ext:Menu>
</Menu>
</ext:SplitButton>
</Items>
</ext:Toolbar>
</Items>
</ext:FormPanel>
</form>
</body>
</html>

Daniil
Aug 05, 2013, 2:08 PM
Hi @blueworld,

I think you already reported it before:)
http://forums.ext.net/showthread.php?24821

blueworld
Aug 05, 2013, 2:17 PM
Thank you for reminding me, I did forget to include the workaround override in my new pages.

However, my main problem still is that the arrow click triggers the redirect, please see my updated democode:

Any fix available?



<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<script runat="server">

</script>

<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<title>Ext.NET v2 Example</title>
<script>
Ext.button.Split.override({
onClick: function (e, t) {
var me = this;

//e.preventDefault(); // this prevents href functionality
if (!me.disabled) {
if (me.overMenuTrigger) {
me.maybeShowMenu();
me.fireEvent("arrowclick", me, e);
if (me.arrowHandler) {
me.arrowHandler.call(me.scope || me, me, e);
}
} else {
me.doToggle();
me.fireHandler(e);
}
}
}
});
</script>
</head>

<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:FormPanel runat="server">
<Items>
<ext:Toolbar>
<Items>
<ext:SplitButton Text="Splitbutton" Href="http://www.ext.net" HrefTarget="_self" ID="SplitButton1" runat="server">
<Menu>
<ext:Menu>
<Items>
<ext:MenuItem Text="Button 1" Href="http://www.ext.net" HrefTarget="_blank" id="MenuItem1" runat="server">
</ext:MenuItem>
<ext:MenuItem Text="Button 2">

</ext:MenuItem>
</Items>
</ext:Menu>
</Menu>
</ext:SplitButton>
</Items>
</ext:Toolbar>
</Items>
</ext:FormPanel>
</form>
</body>
</html>

Daniil
Aug 05, 2013, 3:35 PM
Please try this.

Fix

Ext.button.Split.override({
onClick: function (e, t) {
var me = this;

//e.preventDefault(); // this prevents href functionality
if (!me.disabled) {
if (me.overMenuTrigger) {
e.preventDefault(); // added
me.maybeShowMenu();
me.fireEvent("arrowclick", me, e);
if (me.arrowHandler) {
me.arrowHandler.call(me.scope || me, me, e);
}
} else {
me.doToggle();
me.fireHandler(e);
}
}
}
});

blueworld
Aug 05, 2013, 3:46 PM
Thank you Daniil it does work :)

So it seems that sencha isnt going to fix that one, since my original thread was from may?

Daniil
Aug 05, 2013, 5:25 PM
I updated the Sencha thread. Hopefully, they will answer something.
http://www.sencha.com/forum/showthread.php?263622#post986531