wrong index for old/newIndex in react mixin
See original GitHub issueFor some reason, when sorting items I have 1-based indexes which messes things up when it comes to run items.splice(newIndex, 0, items.splice(oldIndex, 1)[0]);
I’ve had to set this thus:
oldIndex = evt.oldIndex - 1,
newIndex = evt.newIndex - 1
Once I do that, things run fine. Could this be caused by having an element which is not sortable within the same div?
Issue Analytics
- State:
- Created 8 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
wrong index for old/newIndex in react mixin #494 - GitHub
For some reason, when sorting items I have 1-based indexes which messes things up when it comes to run items.splice(newIndex, 0, ...
Read more >error: Do not use Array index in keys - Stack Overflow
When you use index of an array as a key, React will optimize and not render as expected. What happens in such a...
Read more >Sass: @import
Sass extends CSS's @import rule with the ability to import Sass and CSS stylesheets, providing access to mixins, functions, and variables and combining ......
Read more >Documentation - Indexed Access Types - TypeScript
The indexing type is itself a type, so we can use unions, keyof , or other ... You'll even see an error if...
Read more >Indexed Database API 3.0 - W3C
An index has a multiEntry flag . This flag affects how the index behaves when the result of evaluating the index's key path...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@cmoutafidis @Backoo You can now use
event.newDraggableIndex
to get the index of the element only counting draggable elements.So, Sortable will include non-draggable items when returning indexes. Should this be documented somewhere?