I'm having an ultrawebgrid and an ultrawebmenu on my form. The webmenu is configured as an popup menu and does have one option 'Delete'
I did set up everything according to the samples, but when I click right mouse button on my grid, the popup does show, but at the wrong place. It's about 200px down and 100px to the right of the webgrid. I've checked everything and probably oversee something, but what? How do I get the popup menu to appear on the clicked row?
See also the screenshot on how the popup menu now appears. (I clicked with my mouse on the first row of the grid)
Here's my code: (the option in the menu is added by code)
<igtbl:UltraWebGrid ID="grid_FavoriteWineRegions" runat="server" Height="200px" Width="325px"> <Bands> <igtbl:UltraGridBand> <AddNewRow View="NotSet" Visible="NotSet"> </AddNewRow> </igtbl:UltraGridBand> </Bands> <DisplayLayout BorderCollapseDefault="Separate" Name="ctl00xgridxFavoriteWineRegions" RowHeightDefault="20px" Version="4.00"> <ClientSideEvents CellChangeHandler="Grid_Regions_CellClickHandler" MouseUpHandler="Grid_Regions_MouseUpHandler" /> <ActivationObject BorderColor="" BorderWidth=""> </ActivationObject> </DisplayLayout> </igtbl:UltraWebGrid> <ignav:UltraWebMenu ID="Menu_Delete" runat="server" TargetFrame="" TargetUrl="" WebMenuTarget="PopupMenu"> </ignav:UltraWebMenu>
and the BLOCKED SCRIPT
function Grid_Regions_CellClickHandler(gridName, cellId, button){ if(button == 2) { var cell = igtbl_getCellById(cellId); cell.activate(); cell.select(); var grid = igtbl_getGridById(gridName); igmenu_showMenu("ctl00ContentPlaceHolder1ProfilePreferencesMenuDelete", grid.event); }}function Grid_Regions_MouseUpHandler(gridName, id, button){ if(button == 2) { var grid = igtbl_getGridById(gridName); var r = igtbl_getRowById(id); if(r) { igmenu_showMenu("ctl00ContentPlaceHolder1ProfilePreferencesMenuDelete", grid.event); ig_cancelEvent(grid.event); } }}
The reason that I overwrote this function was because we are dealing with Right to Left Languages and the objects still do not support them very well. So my function includes additional code to deal with RTL menu placement. Good luck with your issue.
Thanks. I will try things out. Could it be that the problems are coming from the way i'm using them?
The webdatamenu is in a webusercontrol, which is located on a contentpage of a masterpage. Maybe this constuction does give the problem with incorrect position?
I am overriding the evnt function, but using the Client values to adjust the offset. It worked for me. Hopefully it will work for you.
function ShowIgMenu(menuName, evnt){ var Xoffset = evnt.x - evnt.clientX; var Yoffset = evnt.clientY;
var x = event.x -Xoffset; igmenu_showMenu(menuName, event, x, Yoffset);}
Very odd I must admit.
I copied the code from the sample for the menu. When I display that menu from the grid right click, it appears in the correct position.
When I try the menu based on the one you did, it appeared above the cell where I clicked.
If I take all items out of the menu code from the sample and have a single top level item, then the menu is not displayed in the correct position.
So I'm guessing it might be down to the number of items in the menu somehow interfering with the table. Might be one for the IG guys.
Whats happens if you add a few more menu items (although you probably wont want to in your app I guess).
Andez
Hi,
Sure, that is this line
Menu_Delete.Items.Add("Delete");
running in the page onload event.