Hi,
I am using Web context menu to show some items. The menu is shown just before the right corner of the screen. So some part of menu text is not visible. This is because the menu is always shown to the right of mouse pointer. Can we have the context menu to display on the left side of the pointer when there is not enough space on the right side.
Please let me know how to resolve this.
Thanks in advance.
Hi Maya,
Please let me know if you have any updates on the above issue.
Thanks a lot.
Thanks a lot for the sample code. It gives the width correctly.
But I have created another sample page illustrating the issue. When you right-click the image on the page, it will alert the item's width and then show the menu. On each click, one additional item will be inserted in the menu. So for the first time if you right-click, it shows width correctly and then shows the menu. Then you click on the page anywhere. Again right-click on the menu, it shows width as 0.
So I guess width is returned correctly when menu is showing but not when menu is not showing. But in order to position correctly we will have to get the width before calling showAt? Please let me know what I may be missing here.
Please findattached the sample code illustrating the issue.
Hello sandy_joggy ,
You can get the width of the whole menu element with:
menu.get_element().clientWidth;
Based on that you can calculate what coordinates to pass to the showAt method.
I’m attaching a very simple sample with 2 buttons. One adds new items to the Menu based on the approach suggested in your link. The other moves the menu to the right-most points of the document without showing a scrollbar. Please refer to the attached sample and let me know if this is the dynamic client width you need for your scenario.
Best Regards,
Maya Kirova
Developer Support Engineer
Infragistics, Inc.
http://es.infragistics.com/support
I am referring the following article to show/hide items on client side:
http://codecorner.galanter.net/2011/02/24/infragistics-webdatamenu-csom-additemremoveitem-workaround/#more-1168
So now if I set the width of GroupSettings to some fixed value like 500px, then I wont have any need to figure out the exact width in client side. I want to retirieve the exact width of menu when I add/remove menu items.
Thanks.
I’m not quite sure I fully understand your scenario.
Would it be possible to provide an isolated sample that represents your issue? Alternatively could you share the post that you’ve used for adding/removing items from the client side?
In the meantime try getting the width with:
menu.get_menuGroupSettings().get_width()
Also make sure that you’ve set a width for the GroupSettings for the parent group. For example:
<GroupSettings Width="500px" Orientation="Horizontal" />
I’m looking forward to your reply.