Im having a problem with the web menu in popup mode. When i first show the menu it is positioned properly. But if I scroll my page to the right, show the menu, and try to hover over a root level item the submenu is not displayed in the correct position. Sometimes it is displayed to the far left of the page, and sometimes it displays behind the menu. I was just wondering if this is a known bug with Infragistics35 ver 8.1 and if so is tehre a known workaround or hotfix available?
Hello Guys,
I can suggest two very good resources that can help a lot when it comes to positioning context menus in browsers. You can start by checking out this excellent blog post by Tony Lombardo on how to implement context menu and position it over grid:
http://blogs.infragistics.com/blogs/tony_lombardo/archive/2007/02/20/excel-copy-and-paste-with-netadvantage-for-asp-net.aspx
And also you can review the following discussion in our online forums that provides additional details:
http://forums.labs.infragistics.com/forums/t/3235.aspx
Hope this helps.
The problem I am having is one I have a main page that has a panel in it. The panel has been set to a relative position and overflow:hidden in order to hide the panel with the web splitter. This was how I was told by infragistics to hide the grid in the splitter. So now when I try to render my context menu's in this relative positioned container (panel) it's position is all messed up. I am trying to find some kind of js method that will help me get the offsets to show the menu in the right spot that the user clicked. Any suggestions would be great.
http://weblogs.asp.net/bleroy/archive/2008/01/29/getting-absolute-coordinates-from-a-dom-element.aspx
If you are still using ASP.NET 1.x / 2.x, you can try using the FindPos function proposed by the QuirksMode website (a very useful site on all things Javascript/DOM)
http://www.quirksmode.org/js/findpos.html
I am almost positive that the newly introduced function gives better results than the QuirksMode one. You can also take a look at the following blog post for comments/reflections and suggestions related to positioning and coordinates in browsers:
http://www.jtulloch.com/blog/post/2008/02/Mouse-position---relative-to-a-containing-element.aspx
Hope this helps / provides additional clues.
I need some kind of method that works with both IE and firefox to position the context menu on the user click. I was using your excel example for positioning:
//Firefox passes event arg as parameter (evt). If that is null, we'll use window.event (Internet Explorer proprietary)
//Call show menu with menuID
//specify clientX and clientY to get more accurate positioning for this particular layout
var y = (e.clientY + document.documentElement.scrollTop);
//Firefox (W3C) - cancel event
//InternetExplorer (Proprietary) - cancel event
return false;
But this position that I give for x and y are correct but b/c they are in a relatively positioned panel. It positions them off of the panel and the context menu is way off where it should be.
Cool - glad I was able to help a bit and thanks for sharing your solution with the community. I will do my best to have the Excel example updated (although the problem there is that not all clients have asp:ScriptManager and have not upgraded their framework, but we will see what we can do).
thanks for the help Rumen!
I ended up solving my issue by using the Sys.UI.DomElement.getLocation(element) - with which works both in IE and firefox. My problem which was hindering my positioning of the context menu was that when the user would force the context menu to show in my relatively positioned panel that I would set the x y values of the context menu based off the actual window. Now that I had my offset from the getLocation method I just applied it to the excel positioning method and it works perfectly. Here is my code if anyone ever has the same issue. I created a single context menu method that accepts any of my context menus and positions it accordingly by where the menu is located. If my menu is not in the relatively positioned user control panel I use the copy/excel position. If the menu is in my user control I just apply my offsets to the original x y values to position appropriately
//Show context menu
{
var contextYpos = 0;
//If the current context is from a user get control panel location to position
//context menu correctly
contextXpos = (e.clientX + document.documentElement.scrollLeft) - controlPanelPos.x;
contextYpos = (e.clientY + document.documentElement.scrollTop) - controlPanelPos.y;
}
else
contextXpos = (e.clientX + document.documentElement.scrollLeft);
contextYpos = (e.clientY + document.documentElement.scrollTop);
//Show Menu
Hello,
Thanks for the follow-up. Indeed, the sample code in the Excel example, while good, does not cover all scenarios. Are you using ASP.NET 2.0 / 3.5 with asp:ScriptManager available? If so, you can use
var element = e.target; (the HTML element where click is registered)
var j = Sys.UI.DomElement.getLocation(element);var x = j.x;var y = j.y;
You can also play with e.x and e.y instead of clientX / Y and see if you get better results.