How to use gridOptions.api in streamlit-aggrid

Hi. I know this feature. But it is not what I want.

I finally found the way that how to use gridOptions.api.

I learned it from here.
In the function onFirstDataRendered, the gridOptions was passed into the function as the parameter params.

So I just need to change gridOptions to params in my code.

getContextMenuItems = JsCode("""
function getContextMenuItems(params) {
  var result = [
    {
      name: Show Selected Rows,
      action: () => {
        var selectedNodes = params.api.getSelectedRows();
        var selectedData = selectedNodes.map(node => node.data);
        console.log(`Selected Nodes:\n${JSON.stringify(selectedData)}`);
      },
      cssClasses: ['redFont', 'bold']
    },
    'separator',
    'copy',
  ];
  return result;
}
""")