Pass parameters to onSortEnd function
See original GitHub issueI’m trying to pass a parameters to onSortEnd function but always the data is empty for mine but the indexing work fine.
onSortEndCustom = ({oldIndex, newIndex}, data) => { console.log(data); }
I create my custom function it is working but seems call every time the list changes even if not change the sort, I want same concept as onSortEnd.
So any one know why it is not working to pass parameters or any best solutions?
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (1 by maintainers)
Top Results From Across the Web
reactjs - react-sortable-hoc -- maintain new sort order without ...
The issue is in the onSortEnd callback: onSortEnd(oldIndex, newIndex) { this.setState(({items}) => ({ items: arrayMove(items, oldIndex, ...
Read more >How to use the react-sortable-hoc.SortableContainer function ...
SortableContainer function in react-sortable-hoc ... getPrototypeOf(ModalTabListWrapper)).apply(this, arguments)); } ... onSortEnd = this.
Read more >Drag and Drop in React with 'react-sortable-hoc' - Medium
As you may have noticed, we are passing index as an argument to '.map.' This is because we have to assign each of...
Read more >@alexcheuk/react-sortable-hoc - npm
Use this function to specify a custom container object (eg this is useful for integrating with certain 3rd party components such as FlexTable...
Read more >How to Pass Parameters to Javascript Function? - YouTube
In this lecture, you will learn how to pass parameters to JavaScript function, how to create JavaScript Functions with one or more ...
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 Free
Top 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
I don’t think the
collection
parameter is used for the use case that @Adel-J mentioned in his first comment. From the docs:which if I understand correctly means that the value will just be an identifier for the group and not some custom data.
@clauderic I’m facing the same problem. I want to pass some custom data and read them in the
onSortEnd
. Is that currently possible? To be more specific, eachSortableElement
in mySortableContainer
has an ID which I need to know when handling the sort end.@XeniaSiskaki is right, when you pass
collection
attribute toSortableItem
, sorting brokes. I also need to get item ID ( or any other data ) inonSortEnd
function. The only way seems to work is adding custom attribute toSortableItem
, and try to parse it inonSortEnd
’snodes
property. Like this;SortableItem
itemID
inonSortEnd
Conclusion; All this should be less painful