ipydatagrid icon indicating copy to clipboard operation
ipydatagrid copied to clipboard

Event on arrow key selection?

Open teeling opened this issue 2 years ago • 6 comments
trafficstars

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. :-)

teeling avatar Apr 13 '23 17:04 teeling

That would be a nice feature

rapdum avatar Jun 14 '23 12:06 rapdum

Agreed!

ipcoder avatar Sep 14 '23 14:09 ipcoder

Bump up on this....Is this possible to add as a feature?

jobinnthomas avatar Mar 03 '24 04:03 jobinnthomas

Bump

MLKaufman avatar Jun 18 '24 17:06 MLKaufman

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

image

jgunstone avatar Jul 11 '24 09:07 jgunstone

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")gr

image.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: @.***>

rapdum avatar Jul 11 '24 15:07 rapdum