Setting focused cell when creating a Dash AG Grid table

Hi @jinnyzor, thanks for all your help so far :slight_smile:

I think I’m missing something, because I can’t get it to work. I tried

"eventListeners": {'firstDataRendered': ['params.api.setFocusedCell({rowIndex: 1, colKey: "my_col_name"})']}

and

"eventListeners": {'firstDataRendered': ['params.api.setFocusedCell(1, "my_col_name")']}

and I also found the v31.2 announcement post with an example, so I tried something similar to the example:

AgGrid(
  ...
  eventListeners={"firstDataRendered": ['testFunc(params, cell_clicked)']},
)

"""
This js code in assets/dashAgGridFunctions.js

---------

var dagfuncs = (window.dashAgGridFunctions = window.dashAgGridFunctions || {});

dagfuncs.testFunc = (e, cellClicked) => {
  console.log("HERE IN TEST FUNC");
  console.log(cellClicked);

  e.api.setFocusedCell(cellClicked["rowIndex"], cellClicked["colId"]);
  let focusedCell = e.api.getFocusedCell();

  console.log("focused cell:");
  console.log(focusedCell);
}

"""

which yields no print statements

I’ve verified that I’m on v31.0 as well