Open CnBDM-Su opened 9 months ago
I am also interested in resolving this. When onclick function is triggered, the selection returned in the field
I have the same problem. A solution would be great! Here is a minimal example (no print after table.select):
import pandas as pd
import ipywidgets as widgets
from ipydatagrid import DataGrid
df = pd.DataFrame(
{
'A': [10, 20, 30, 40],
'B': [50, 60, 70, 80]
}
)
table = DataGrid(df, selection_mode='row')
def update_on_selection(change):
print("selection changed:", change['new'])
table.observe(update_on_selection, names='selections')
display(table)
table.select(0, 0)
I'm facing the same issue. A solve or workaround would be great.
The selection function cannot trigger traitlets observe.
I am using select(), trying to realize control table both with manual and with function. The observe function of table is only triggered when click, but not after select() function.
Do you know how to trigger it?
Example: def func(change): ... datagrid.observe(func, name=['selections']) datagrid.select(row1=rows,column1=1,row2=rows, column2=1)
*func should be run based on new selections, but not.