Ag grid 在适应性上下文菜单中,是否有基于单元格值更改标签文本的方法

Ag grid 在适应性上下文菜单中,是否有基于单元格值更改标签文本的方法,ag-grid,Ag Grid,我们可以看到,我们可以为菜单单击提供函数,还可以为是否显示菜单项提供谓词。但在我们的用例中,我们根据单元格值更改菜单项的文本,例如,如果单元格值为Joe Bloggs,则菜单应为“Joe Bloggs more info…”是的,这相当简单 见: 您将需要以下内容: adaptableOptions.userFunctions=[ { type: 'UserMenuItemLabelFunction', name: 'changeMenuLabel', handler(m

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

是的,这相当简单

见:

您将需要以下内容:

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': ''
    },
}
]

是的,这相当简单

见:

您将需要以下内容:

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': ''
    },
}
]