You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
zacstewart
added a commit
to DirtJockey/ember-cli-sortable
that referenced
this issue
Oct 8, 2015
We currently have it setup with two way data-binding. So the collection you want is the one that you're giving the addon to play with, you should have access to it.
I will be refactoring this plugin to use data-down and actions-up methodology, soon. That should solve your problem.
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 theirposition
.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 theposition
property on all of them, and then make my request to the server to persist the ordering.Would you accept a PR for this?
The text was updated successfully, but these errors were encountered: