Event listener for selection changes?

66 views
Skip to first unread message

jl

unread,
Feb 19, 2025, 11:28:19 AM2/19/25
to zotero-dev
Hi!

I'm looking for a way to listen for changes in the current item selection in Zotero (when users select different items in the library). Zotero.Notifier mainly covers database changes, but it doesn't seem to support selection change events. Is there an alternative way to detect selection changes in the Javascript API?

Otherwise, I think I can use MutationObserver on .virtualized-table-body and call ZoteroPane.getSelectedItems whenever I observe a change in the selection based on .selected.

Thanks!

XY Wong

unread,
Feb 19, 2025, 12:01:06 PM2/19/25
to zotero-dev
ZoteroPane.itemsView.onSelect.addListener(() => Zotero.debug("selected"));

jl

unread,
Feb 19, 2025, 5:42:52 PM2/19/25
to zotero-dev
Thanks! So much easier... :)
Reply all
Reply to author
Forward
0 new messages