Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I spent a long time a few weeks ago looking for a replacement for jQueryUI's sortable(), but none of the DnD libraries supported both sortable and the grid option out of the box. Would yours work for that? Here's where we want to use it: https://pamelafox.github.io/faded-parsons-static/problem.htm...


Good question. Internally every registered element has a grid position inside its own container [1]. And it's not CSS grid styling, it actually calculates the geometry in each element and positioned them relative to their parent container. This is the implementation behind the enhanced transformation. Based on the grid position, DFlex can call the right method responsible for transformation instead of checking siblings linearly. For example, if you transform an element in the middle of the container it only invokes the switching position method instead of iteration in the entire tree. Still, grid implementation is not fully implemented and supported yet. But it's something that can be done in the next releases. However, the link you shared has an interesting case because you are resizing the element when appending it to the new container. I'd like to see a repo if it's possible but it's a very interesting case I'd love to look into it.

[1]- https://github.com/dflex-js/dflex/blob/cbda61af185100a3afb39...


Thanks for the response! Here's the code for our use case: https://github.com/pamelafox/faded-parsons-static/blob/maste...

It calls jQuery UI sortable() with a "grid" of [50, 1], to mimic Python indentability. Here's their documentation for grid: https://api.jqueryui.com/sortable/#option-grid


Thanks for sharing the link I'll look into it soon.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: