Skip to content

onMove return value not passed back to Sortablejs #14

Open
@crystalfp

Description

@crystalfp

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions