I am using a Javascript function stored in assets/dashAgGridFunctions.js file. And I am calling that while assignin values to my dash ag grid’s agSelectCellEditor. But I am getting the below error:
“s.forEach is not a function”
Can you please provide a complete minimal example that replicates the error?
Hi @AnnMarieW ,
Thank you for your response.
Here is the grid definition:
def create_iv_variables_grid(on_config_tab=False, rowData=None, editable=True):
"""Create AG Grid for Independent Variables (IV)"""
column_definitions = []
if not on_config_tab:
column_definitions.append({
"headerName": "",
"checkboxSelection": True,
"headerCheckboxSelection": True,
"width": 50,
"suppressMenu": True,
})
column_definitions += [
{
"headerName": "IV",
"field": "iv_id",
"editable": False,
"filter": False,
"width": 80,
},
{
"headerName": "Server",
"field": "iv_server",
"editable": editable,
"filter": True,
"tooltipField": "Data Server Type",
"cellEditor": "agSelectCellEditor",
"cellEditorParams": {"values": []},
},
{
"headerName": "IV Name",
"field": "iv_name",
"editable": editable,
"filter": False,
"tooltipField": "iv_name",
},
{
"headerName": "IV Values",
"field": "iv_value",
"editable": True if (not on_config_tab and editable) else False,
"filter": False,
"tooltipValueGetter": {
"function": "params.value ? 'At least 2 levels are required. Separate multiple levels with commas. Recommended to start with less than 4 levels to avoid combinatorial explosion.' : ''"
},
},
{
"headerName": "Tag",
"field": "iv_tag",
"dangerously_allow_code": True,
"editable": editable,
"filter": True,
"cellEditor": "agSelectCellEditor",
"cellEditorParams": {"values": {"function": "get_tags_for_selected_server"}},
}
]
return dag.AgGrid(
id='iv_variables_table' if not on_config_tab else 'config-iv-variables-table',
columnDefs=column_definitions,
rowData=rowData or [],
columnSize="sizeToFit",
defaultColDef={
"resizable": True,
"sortable": False,
},
dashGridOptions={
"rowSelection": "multiple",
"animateRows": True,
"tooltipShowDelay": 300,
"suppressRowClickSelection": True,
"readOnlyEdit": False,
"stopEditingWhenCellsLoseFocus": True,
"singleClickEdit": True,
"domLayout": "autoHeight",
},
)
And I have the JavaScript function - “get_tags_for_selected_server” defined in "assets/dashAgGridFunctions.js file.
Thanks for posting some code, but it’s not enough information to help. Please include the JavaScript function and a small amount of sample data. We should be able to copy your example, run it locally and see the same error.
See this post for more information: