Skip to content

Sortable-jquery-binding and Requirejs #1061

@rdoepke

Description

@rdoepke

Using sortable-jquery-binding.js requires to have Sortable in global namespace. This is because it does not require sortable as a dependency. Otherwise, having the requirejs config as in the following snippet will not work. I also cannot get it to work via shim config.

requirejs.config({
  paths: {
     // ...
     'jquery.sortable': 'sortable-jquery-binding',
     'sortable': 'sortable-1.4.2.min',
  }
})

as this will cause an Uncaught ReferenceError: Sortable is not defined in l38 of the binding when using the sortable constructor.

The only possible way for me is to require both libraries and making Sortable global as in #8 before making the jquery call which is not the way it is supposed to work:

require(['sortable', 'jquery', 'jquery.sortable'], function (Sortable, $){
    window.Sortable = Sortable;
    $('#myContainer').sortable();
});

Any hints on this?

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