Sortable: Wrong oldIndex in nested Sortable events

Created on 16 Dec 2015  Â·  9Comments  Â·  Source: SortableJS/Sortable

Hello,

I made a Sortable (let's call it B) inside a Sortable (let's call it A) item element. When I drag B's items around, oldIndex property seems to be the parent's index instead of its own.

For example, if inside A2 I drag B4 and put it at index 3, the event's indexes will be

oldIndex: 2,
newIndex: 3

instead of

oldIndex: 4,
newIndex: 3

http://jsbin.com/henuzikaka/edit?html,js,output

On a side note, it seems that on the dev branch all indexes new and old, nested or not, are always 0.

Most helpful comment

Any reason this is not merged into master yet? Just noticed this issue, and the commit solves it. I think most of the referenced use cases is for nested, but independent sortables and not the unsupported sortable "tree".

All 9 comments

Sortable — not officially supported nesting.

It might be interesting to add some sort of namespace support to avoid nesting problems.

@RubaXa would you consider merging it if it didn't add too much complexity ?

@nleclerc, @ldanet Oh, sorry, I'm all confused, try dev-branch.

Thank you, it works :+1:

Nice work man :-D

On Wed, 16 Dec 2015 at 15:56 ldanet [email protected] wrote:

Thank you, it works [image: :+1:]

—
Reply to this email directly or view it on GitHub
https://github.com/RubaXa/Sortable/issues/701#issuecomment-165132787.

Any reason this is not merged into master yet? Just noticed this issue, and the commit solves it. I think most of the referenced use cases is for nested, but independent sortables and not the unsupported sortable "tree".

+1

+1

+1

Was this page helpful?
0 / 5 - 0 ratings

Related issues

seltix5 picture seltix5  Â·  3Comments

tom-sherman picture tom-sherman  Â·  3Comments

Webifi picture Webifi  Â·  3Comments

benfoster picture benfoster  Â·  3Comments

artaommahe picture artaommahe  Â·  4Comments