I have been trying for 2 days now to integrate a table into svelte where I can select with mouseDown and dragging.
I´m new in js and svelte and did a few courses.
But at this moment is not possible for me to get this working.
Thats what i try to build in svelte: TableSelect
Hope anyone can help me.
Many thanx, Chris
It turned out slightly more complicated than suggested in my comment.
The idea is to listen to
mousedownandmouseupevents on the entire window (through<svelte:window>) to toggle anisDragstate on/off, listen tomouseenterevents on table cells, then toggle the cells on/off only ifisDragis on.Additionally, you will have to listen to the
mousedownevent on cells as well, in case the dragging is started inside a cell.The on/off state of a single cell can be shown visually with a
class:selectedattribute.Demo REPL