2
votes

Is it possible to add custom HTML elements to an icon to an Ag-grid context menu item? The following doesnt render any icon:

 getContextMenuItems = (params) => [
    {
      name: 'Cancel items',
      action: this.onCancelLocates(),
      icon:  <span><Icon name="cancel" size="small" /></span>
    },
    'separator',
    'copy',
    'copyWithHeaders',
    'paste',
    'separator',
    'export'
  ]
1
Does this answer your question? Unable to execute function in Context Menu - NicuVlad
That link also did not work, may be because of not having appropriate framework css import. - MindRoasterMir

1 Answers

0
votes

This is how you can add custome icons

 getContextMenuItems = (params) => [
{
  name: 'Cancel items',
  action: this.onCancelLocates(),
  icon:  '<span class="ag-icon ag-icon-save" unselectable="on" role="presentation"></span>'
},
'separator',
'copy',
'copyWithHeaders',
'paste',
'separator',
'export'  ]

You can get this span code from right clicking the already present icons inside the context menu. Thanks