hello,
I use the component WebDataMenu Context Menu mode. I linked the event GridMousDown to display the menu on a webdatagrid. I test in javascript if the click is located on a line or off depending on the case and I hides menu items or not. The problem is that when I face one items, the menu background does not resize. Is there a solution for this?
here is my javascript code in case I hide items:
var menu = $ find ("<%= this.ContextMenuGrid.ClientID %>"); for (i = 0; i <= menu.getItems (). get_length () - 1, i + +) { if (menu.getItems (). getItem (i). get_key () == "Delete") { menu.getItems (). getItem (i). set_visible (false); } else if (menu.getItems (). getItem (i). get_isSeparator () == true) { menu.getItems (). getItem (i). set_visible (false); } else { menu.getItems (). getItem (i). set_visible (true); } } if (menu! = null & & eventArgs.get_browserEvent ()! = null & & eventArgs.get_browserEvent (). button == 2) { menu.showAt (null, null, eventArgs.get_browserEvent ()); } Thank you for your help
Hi julienm,
Thank you for posting in the community.
One approach you can try is to first set the EnableScrolling property of the menu to false. Afterwards you should be able to use something similar to the below javascript in order to "shrink" the main div of WebDataMenu:
//that's the height of the ul list which contains the root items (given that scrolling is disabled) var heightToSet = ig_controls.WebDataMenu1.get_element().children[0].offsetHeight; // set the height of the main div ig_controls.WebDataMenu1.get_element().style.height = heightToSet + "px";
//that's the height of the ul list which contains the root items (given that scrolling is disabled) var heightToSet = ig_controls.WebDataMenu1.get_element().children[0].offsetHeight;
// set the height of the main div ig_controls.WebDataMenu1.get_element().style.height = heightToSet + "px";
Please let me know if this helps.
Petar thank you very much,I thought the property was EnableScrolling defaults to false and had not found the need to force this setting.I did not need to apply the resizing of ul.Thank you again for your helpI fenced my question.
Thank you for your reply.
Please feel free to contact me if you have further questions regarding this matter.