Is there a way to create form context submenu for a form context menu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2016 05:50 AM
Using Ui context menu, It is possible to create a submenu in a menu but over list view . I am trying to create a form context menu I did it using Ui action but is it possible to create submenu under that. I am not able to find any helpful link for doing so.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2017 01:13 PM
Did you ever find a way of doing this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2017 10:14 AM
Incase you still wanted a solution, or for anyone else who comes across this, here's what I ended up doing.
At first i was hoping it would be possible to modify the code which generates the form header context menu and add some logic for creating submenus from a new field on the ui action table. Unfortunately although some of the context menu is generated from various ui macros it seems the code which generates the ui actions part of the menu is not available for customisation.
I ended up coming up with the following client side code which modifies the menu after it's created. It's not an ideal solution since it involves a bit of DOM manipulation but it does the job. This can be run in an onload client script for the specific table you want to add sub menus on. The array at the beginning defines the structure for the new submenus.
(function() {
// new submenus: items array denotes the sysids, names and/or onclick functions of the ui actions
// to move into them (if ui action is set to client=true the name of the onclick function must be
// used otherwise if it has a name (e.g. 'sysverb_insert') that must be used otherwise use the sysid
// submenus/items will appear in the order listed
var subMenus = [
{
name: 'Submenu 1',
items: [
'<ui action name>',
'<ui action sysid>',
'<ui action onclick>'
]
},
{
name: 'Submenu 2',
items: [
'<ui action name>',
'<ui action sysid>',
'<ui action onclick>'
]
}
];
// get context menu
var gcm = new GwtContextMenu('context_1');
var jcm = $j(gcm.menu);
// create and position new sub-menus
for (var i = 0; i < subMenus.length; i++) {
var sm = subMenus[i];
var gcsm = new GwtContextMenu('new_context_submenu_' + i);
// insert new menu just before the first line break (bottom of the ui actions context menu section)
jcm.find('div.context_item_hr:first')
.before(gcm.addMenu(sm.name, gcsm));
// move items into the menu
for (var j = 0; j < sm.items.length; j++) {
jcm.find('div.context_item[href*="' + sm.items[j] + '"]')
.appendTo(gcsm.menu);
}
}
})();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2017 01:33 AM
Even if its DOM manipulation, great solution!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2023 01:17 AM
Hello,
I'm trying to implement your solution, what if the UI action is set to client=true and has an action name as well? I tried both of them and the submenu does not appear.
Thanks!