Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8195157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:02:21+00:00 2026-06-07T05:02:21+00:00

I need to create items that have drag and drop and sort functionality. So

  • 0

I need to create items that have drag and drop and sort functionality. So an item can be dragged into another item.

I have seen a few solutions to do drag via a mixin and create a draggable view using this mixin and then creating another view from droppable via the droppable mixin.

But i need each item / view to have draggable, droppable and sortable functionality.

Please can anyone tell me the best way to do this via mixins or subclassing or … ?

Also can i create a jqueryUi mixin as a base mixin and then use that mixin when creating the draggable, droppable and sortable mixins ? is this possible ?

Is it best to use jqueryUI or the html5 drag and drop api or something else ?

Thanks for the help
Rick

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T05:02:23+00:00Added an answer on June 7, 2026 at 5:02 am

    Not sure if you saw the code by Katz here, but I’m using this to make a View: Droppable, Draggable, … or any other interaction supported by jQuery UI. So you define a base Mixin, which you will use in all jQuery UI interaction Mixins:

    // Create a new mixin for jQuery UI widgets using the new SproutCore 2.0
    // mixin syntax.
    JQ.Base = Ember.Mixin.create({
      // When SproutCore creates the view's DOM element, it will call this
      // method.
      didInsertElement: function() {
        this._super();
    
        // Make jQuery UI options available as SproutCore properties
        var options = this._gatherOptions();
    
        // Make sure that jQuery UI events trigger methods on this view.
        this._gatherEvents(options);
    
        // Create a new instance of the jQuery UI widget based on its `uiType`
        // and the current element.
        var ui = jQuery.ui[this.get('uiType')](options, this.get('element'));
    
        // Save off the instance of the jQuery UI widget as the `ui` property
        // on this SproutCore view.
        this.set('ui', ui);
    
    
      },
    
      // When SproutCore tears down the view's DOM element, it will call
      // this method.
      willDestroyElement: function() {
        var ui = this.get('ui');
    
        if (ui) {
          // Tear down any observers that were created to make jQuery UI
          // options available as SproutCore properties.
          var observers = this._observers;
          for (var prop in observers) {
            if (observers.hasOwnProperty(prop)) {
              this.removeObserver(prop, observers[prop]);
            }
          }
          ui._destroy();
        }
      },
    
      // Each jQuery UI widget has a series of options that can be configured.
      // For instance, to disable a button, you call
      // `button.options('disabled', true)` in jQuery UI. To make this compatible
      // with SproutCore bindings, any time the SproutCore property for a
      // given jQuery UI option changes, we update the jQuery UI widget.
      _gatherOptions: function() {
        var uiOptions = this.get('uiOptions'), options = {};
    
        // The view can specify a list of jQuery UI options that should be treated
        // as SproutCore properties.
        uiOptions.forEach(function(key) {
          options[key] = this.get(key);
    
          // Set up an observer on the SproutCore property. When it changes,
          // call jQuery UI's `setOption` method to reflect the property onto
          // the jQuery UI widget.
          var observer = function() {
            var value = this.get(key);
            this.get('ui')._setOption(key, value);
          };
    
          this.addObserver(key, observer);
    
          // Insert the observer in a Hash so we can remove it later.
          this._observers = this._observers || {};
          this._observers[key] = observer;
        }, this);
    
        return options;
      },
    
      // Each jQuery UI widget has a number of custom events that they can
      // trigger. For instance, the progressbar widget triggers a `complete`
      // event when the progress bar finishes. Make these events behave like
      // normal SproutCore events. For instance, a subclass of JQ.ProgressBar
      // could implement the `complete` method to be notified when the jQuery
      // UI widget triggered the event.
      _gatherEvents: function(options) {
        var uiEvents = this.get('uiEvents') || [], self = this;
    
        uiEvents.forEach(function(event) {
          var callback = self[event];
    
          if (callback) {
            // You can register a handler for a jQuery UI event by passing
            // it in along with the creation options. Update the options hash
            // to include any event callbacks.
            options[event] = function(event, ui) { callback.call(self, event, ui); };
          }
        });
      }
    });
    

    And then define the Draggable Mixin:

    JQ.Draggable = Ember.Mixin.create( JQ.Base, {
        uiType: 'draggable',
        uiOptions: ['disabled', 'addClasses', 'appendTo', 'axis', 'cancel', 'connectToSortable', 'containment', 'cursor', 
                  'delay', 'distance', 'grid', 'handle', 'snap', 'snapMode', 'stack'],
        uiEvents: ['create', 'start', 'drag', 'stop']
    
    });
    

    the Resizable Mixin:

      JQ.Resizable = Ember.Mixin.create( JQ.Base, {
        uiType: 'resizable',
        uiOptions: ['disabled', 'alsoResize', 'animate', 'animateDuration', 'animateEasing', 'aspectRatio', 'autoHide', 'cancel', 
                  'containment', 'delay', 'distance', 'ghost', 'grid', 'handles', 'helper', 'maxHeight', 'maxWidth', 'minHeight',
                  'minWidth'],
        uiEvents: ['create', 'start', 'resize', 'stop']
    });
    

    Basically for each UI interaction you want to define the uiType (draggable, droppable, sortable, etc.), the uiOptions of the interaction (observed by the mixin), and the uiEvents of the interaction that you want to implement in your View.

    By including JQ.Draggable and JQ.Droppable in your View, it automatically becomes draggable and droppable + you are able to change its options in your View and reflect those changes on the UI plugin, e.g. this.set('delay', 900), and implement the plugin events in your View, e.g. drag: function(){ /* do something when dragging*\ } ).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a drag and drop calendar that 'on drop' needs to pass the
i have created the drag and drop work. Here i can place the drag
I'm trying to create a ListView with items that have two lines of text,
I currently have a table(/grid) of data that I can page, filter and sort.
I`v come across a need where I want to create multiple list items from
I need create custom dialog and put JPanel into it. Is it possible?
I need create clone repository. but I do not know where can I get
I need create a document word with Java. And I ask, how can I
I have dynamically created WrapPanel (_wp) with several Borders. And I need create handler
I need to create a WP site which will have multiple subjects. Each subject

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.