Skip to content

calling onItemMoveAction with the re-ordered collection would be nice #10

@zacstewart

Description

@zacstewart

I have a situation where I want to make a list of images sortable. The collection of images is using sortBy to maintain order using a position property. This gets stored on the backend, and I need to update the server with a contiguous sequence of positions every time you re-order the list.

Getting the old and new indices in the onItemMoveAction isn't very helpful, because it only lets me update that position property on the single item dropped. Since I'm using a sorted collection, every time I use this.get('images') they get re-sorted according to their position.

Passing the collection in as an argument to the action solves this problem, because then I have the newly ordered collection of images. I can update the position property on all of them, and then make my request to the server to persist the ordering.

Would you accept a PR for this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions