Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting all elements positions #361

Open
lmatheus opened this issue Dec 30, 2016 · 1 comment
Open

Getting all elements positions #361

lmatheus opened this issue Dec 30, 2016 · 1 comment

Comments

@lmatheus
Copy link

Is there a way of knowing the index of all the draggable elements?

The only thing I have found is the current "order changed" or "item moved" element by using the event.dest.index (and this is relative to the parent). Haven't found a way of getting all of the elements indexes at once.

The intention is to save this positions on the database so I can retain their position when it changes.

@franbueno
Copy link

Hi @lmatheus,

You can get it each time you move an element. Thats what i do:

orderChanged: function (event) {
//Mapped because i only need ID
var tasks = event.source.sortableScope.modelValue.map(function(a) {return a.id;});;
//Update tasks with new positions
console.log(tasks);
ctrl.updateSort(tasks);
}

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

No branches or pull requests

2 participants