question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrong oldIndex in nested Sortable events

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:9

github_iconTop GitHub Comments

6reactions
mikemliucommented, Jun 16, 2016

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”.

0reactions
lukapehardacommented, Oct 24, 2016

+1

Read more comments on GitHub >

github_iconTop Results From Across the Web

jquery ui sortable: How to get current index with id and old ...
I am using jquery UI to change the position of the table and pass this jquery event arguments through ajax while taking index...
Read more >
jQuery Sortable
Sorts any items in any container · Fully supports nested containers · Connect lists · Callbacks and events (see docs) · Pure drag/drop...
Read more >
Sortablejs-nesting NPM
Sortable is a minimalist JavaScript library for reorderable drag-and-drop lists. Demo: http://rubaxa.github.io/Sortable/. Features. Supports touch devices and ...
Read more >
Sortable Widget | jQuery UI API Documentation
Function: A function that will return a DOMElement to use while dragging. The function receives the event and the element being sorted. Code...
Read more >
Sortable - Best of JS
Sortable is a JavaScript library for reorderable drag-and-drop lists. ... before cancelling a delayed drag event disabled: false, // Disables the sortable ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found