hi i have an issue in dash callback, try to solve it many hours and didn’t success
i added the following callback to dash Ag Grid in order to add new row for editing
each time user start to edit the last row
but in the output i got more rows then i expected its seems that the output is updated twice
but i have no callback with the same output
this is my code the callback: @callback(
Output(‘numeric_table’, ‘rowData’),
[Input(‘numeric_table’, ‘cellValueChanged’)],
[State(‘numeric_table’, ‘rowData’)]
)
def add_new_row(cell_value_changed, row_data):
meas_params.numeric_parameters_row_data = row_data
if ctx.triggered[0][‘prop_id’] == ‘numeric_table.cellValueChanged’:
meas_params.numeric_parameters_row_data = row_data
last_row = row_data[-1]
if last_row[‘name’] != ‘’:
new_row = {‘name’: ‘’}
meas_params.numeric_parameters_row_data.append(new_row)
return meas_params.numeric_parameters_row_data
return dash.no_update
the ag grid :
ag.AgGrid(
id=‘numeric_table’,
columnDefs=self.numeric_parameters_column_defs,
rowData=self.numeric_parameters_row_data,
dashGridOptions={‘rowSelection’: ‘single’, “rowMultiSelectWithClick”: False,
“suppressRowClickSelection”: True, “animateRows”: False},
columnSize=“responsiveSizeToFit”,
getRowId=“params.data.index”,
persistence=True,
style={‘width’: ‘100%’, ‘height’: ‘85%’}
)
I would be very grateful to anyone who has a solution for me
hi
thanks for responding
i change the callback using ‘rowTransaction’ in output
and again, when i editing one row its return me multiple redundant rows
attached the updated code: