I’ve got this div – let’s call it dragging – in a Liveview . It has a Hook that runs sortableJS on the client to make the list drag-drop. For sortableJS to work properly, I need to have phx-update="ignore". However, on the same Liveview there are other forms that modify the content of the dragging div. But that whole div doesn’t update because it’s set to phx-update="ignore" . Is there a way to override this? Is there a way to make ignore dynamic?
There semi-related discussion recently here. You definitely don’t need phx-update="ignore" for sortablejs to work, you likely just need to expand the scope of your hook.
I think the reason I have phx-update="ignore" is because I’ve got multidrag on. Thanks for pointing me to todo_trek. I’ll go study and see how I can integrate those ideas.
So, I took his project, added multidrag and it has a weird behavior with sortableJS. My beginner’s hunch is that multidrag and streams are conflicting.
You can see in the video that it selects the items properly, moves them, but its gets screwy when I drop them.
My guess is that sortable keeps track of selected items by referencing the HTML element and – when Phoenix streams updates – it recreates some HTML elements and sortable loses track of what was selected.