mharris717 / ember-drag-drop

Drag and Drop Addon for Ember CLI
MIT License
204 stars 141 forks source link

Passing hasMany relationship into {{#sortable-objects}} #175

Open ianpetzer opened 4 years ago

ianpetzer commented 4 years ago

Hi there,

I'm struggling to pass a hasMany relationship into a {{#sortable-objects}}. It works fine in the simple case of a single sortable list but I'm finding that if either: 1) Use a single list and set inPlace=true 2) Use multiple lists and drag from one list to a list to another where the sortObjectList is a hasMany relationship I get the following error:

items.findIndex is not a function

This is coming from: https://github.com/mharris717/ember-drag-drop/blob/2f29c0ec2cad81f4ce5146fe571b3cfad40a4995/addon/services/drag-coordinator.js#L8 as a hasMany relationship does not support the findIndex function

ianpetzer commented 4 years ago

This PR https://github.com/mharris717/ember-drag-drop/pull/176 solves the issue in my specific case of using an ember hasMany proxy. Would this be usable in all scenarios?