Flexmonster MCP Server is here! Connect your ✨AI assistant to our documentation. Get started
+

Unable to add class name to a submenu via API Call customContextMenu()

Answered
uchivoitachi uchivoitachi asked on August 4, 2021

Hello Team,
 
it seems unable to add a specified class name to a submenu(but works fine in non-sub menu),
and also want to know how to use ContextMenuItem.isSelected?
 
function customContextMenu(items,data){
item.push({
label:'parent menu',
class:'class1',// works fine
submenu:[
{
label:'child menu',
class:'class1'//not work
}
]
});
}
 
how to make submenu's class valid?
 
we also want to know how to use the property "isSelected", since there is a requirement that when the menu isSelected,apply a specified css class to it.

4 answers

Public
Mykhailo Halaida Mykhailo Halaida ⋅ Flexmonster ⋅ August 5, 2021

Hi,
 
Thank you for posting your question.
 
There seems to be an issue with applying classes to submenu items with customizeContextMenu() – we'll take a look at this and provide a fix with our upcoming release ETA Aug 23rd.
 
Speaking of the isSelected property, it indicates whether the menu item is checked. Here's a sample showcasing how to apply different CSS classes depending on the isSelected value: https://jsfiddle.net/flexmonster/p4mrhsxa/.
 
Please let us know if there is anything else we can help you with.
 
Best regards,
Mykhailo

Public
uchivoitachi uchivoitachi ⋅ August 18, 2021

Thanks!

Public
Mykhailo Halaida Mykhailo Halaida ⋅ Flexmonster ⋅ August 24, 2021

Hi,
 
Hope you’re doing well!
 
We’ve released a fix addressing the issue with applying CSS classes to submenu items in customizeContextMenu().
 
This is available in the 2.9.6 version of Flexmonster: https://www.flexmonster.com/release-notes/.
 
You are welcome to update the component. Here is our updating to the latest version guide for assistance: https://www.flexmonster.com/doc/updating-to-the-latest-version/.
 
Best regards,
Mykhailo

Public
uchivoitachi uchivoitachi ⋅ August 31, 2021

thanks

Please sign in or register to submit your answer