在 AdapTable 上下文菜单中,有一种方法可以根据单元格值更改标签文本

In the AdapTable Context Menu is there a way to change the label text based on the cell value

我们可以看到,我们可以为菜单点击提供函数,也可以为是否显示菜单项提供谓词。但在我们的用例中,我们根据单元格值更改了菜单项的文本(例如,如果单元格值为 Joe Bloggs,则菜单应显示为 'Joe Bloggs more info...')

是的,相当简单

参见:https://docs.adaptabletools.com/docs/user-interface/context-menu#editing-user-context-menu-entries

你会想要这样的东西:

adaptableOptions.userFunctions=[
{
    type: 'UserMenuItemLabelFunction',
    name: 'changeMenuLabel',
    handler(menuInfo) {
        // change if Joe Bloggs otherwise return empty string so normal label displayed
       return menuInfo.GridCell.displayValue === 'Joe Bloggs' ? 'Joe Bloggs More Info': ''
    },
}
]