Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onMove return value not passed back to Sortablejs #14

Open
crystalfp opened this issue Feb 14, 2021 · 0 comments
Open

onMove return value not passed back to Sortablejs #14

crystalfp opened this issue Feb 14, 2021 · 0 comments

Comments

@crystalfp
Copy link

I define a onMove function to prevent list sorting this way:

onMove(event) {
    console.log("onMove called");
    return false;
}

and pass it to knockout-sortablejs:

            <div data-bind="sortable: {foreach: documentList, options: {
                            onMove: $component.onMove,
                            handle: '.list-layout-handle'}}">

When I move an element, the onMove function is called, but the return value that should prevent sorting is ignored.

The solution seems to be adding a missing return to lines 79 and 81 this way:

                    if (handler)
                        return handler(e, itemVM, parentVM, collection, bindings);
                    if (eventHandlers[eventType])
                        return eventHandlers[eventType](e, itemVM, parentVM, collection, bindings);

Hope it can help
mario

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant