Skip to content

Conversation

@MaxwellRebo
Copy link

This adds Draggabilly support by default.

If you'd rather this was optional, can do a separate PR for that.

@efournival
Copy link

Hi,
I know this is an old PR but this is not working when adding elements dynamically.
You are creating a new Dragabilly instance each time performLayout is called, which cause multiple instances of Dragabilly being binded when the grid is updated. It causes the layout to be completely messed up with strange gaps.
My solution was to only make new elements draggable:

        performLayout: function() {
            var diff = this.diffDomChildren();

            if (diff.removed.length > 0) {
                this.packery.remove(diff.removed);
            }

            if (diff.appended.length > 0) {
                this.packery.appended(diff.appended);
                diff.appended.forEach( this.makeEachDraggable );
            }

            if (diff.prepended.length > 0) {
                this.packery.prepended(diff.prepended);
                diff.prepended.forEach( this.makeEachDraggable );
            }

            this.packery.reloadItems();
            this.packery.layout();
        },

@MaxwellRebo
Copy link
Author

Let me have a look shortly. Do you mind if I use your solution and compare?

@efournival
Copy link

Yeah of course, let's say the code I gave above is public domain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants