ipydatagrid
ipydatagrid copied to clipboard
Event on arrow key selection?
From what I can tell, there is no way to catch selection events when moving a selection with the arrow keys. An example: I subscribe to cell clicks with
grid.on_cell_click(cell_changed)
So if I click a cell, my function "cell_changed" triggers. But if I now use the arrow keys on the keyboard to navigate to the next cell I get no event.
Is there such an event? If not, this is a feature request. :-)
That would be a nice feature
Agreed!
Bump up on this....Is this possible to add as a feature?
Bump
you can observe selections:
from ipydatagrid import DataGrid
gr = DataGrid(pd.DataFrame({"a": list("abcd"), "b": [1,2,3,4]}), selection_mode = "cell")
# watch selections
gr.observe(lambda change: print(change), "selections")
gr.selections = [{"r1": 1, "r2": 1, "c1": 1, "c2": 1}]
# watch changes
# gr.on_cell_change(lambda change: print(change))
# gr.set_cell_value("a", 0, "b")
gr
Thx a lot, works like a charm!
On Thu, Jul 11, 2024 at 11:11 AM John Gunstone @.***> wrote:
you can observe selections:
from ipydatagrid import DataGridgr = DataGrid(pd.DataFrame({"a": list("abcd"), "b": [1,2,3,4]}), selection_mode = "cell")
watch selectionsgr.observe(lambda change: print(change), "selections")gr.selections = [{"r1": 1, "r2": 1, "c1": 1, "c2": 1}]
# watch changes# gr.on_cell_change(lambda change: print(change))# gr.set_cell_value("a", 0, "b")grimage.png (view on web) https://github.com/bloomberg/ipydatagrid/assets/21370980/71c07148-9147-43be-a4f1-7d195633cac8
— Reply to this email directly, view it on GitHub https://github.com/bloomberg/ipydatagrid/issues/411#issuecomment-2222422461, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACXNBHAP5KHLG4PIOTW72FDZLZD55AVCNFSM6AAAAAAW5LMLOSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRSGQZDENBWGE . You are receiving this because you commented.Message ID: @.***>