0

I implemented jQuery UI draggable and selectable. When I have two component with initialized both of it and I select one of them, if I click to the other component without mouse release and start dragging it then the "ui-selected" class is removed from the other component but it did not enter in any event of selectable.

I need a method or event where enters after the action I described above.

Selectable:

Selectable: {
        init: function(el) {
            $(el).selectable({
                filter: '.existing-component', 
                selecting: function (event, ui) {
                    $(event.target).children('.ui-selecting').find('.existing-component').removeClass('ui-selecting');
                },
                stop: function(event, ui) {
                      console.log('stop');
                });
                start: function(event, ui) {
                      console.log('start');
                });
            });
            // manually trigger the "select" of clicked elements
            $(el).find('.existing-component').click( function(e){
              .
              .
              .
              $(el).selectable('refresh');
              $(el).data("ui-selectable")._mouseStop();
            });
         }
       }

Draggable:

Draggable: {
        init: function(el, options) {

            $(el).draggable(options, {
                scroll: false,
                snap: '.gridlines',
                snapTolerance: $('.grid').attr('data-size') / 2,
//              revert: "invalid",
                preventCollision : true,
                preventProtrusion : false,
                collisionVisualDebug : false,

                drag: function(event, ui) {
                      console.log('drag')
                }
          });
     }
}
MSeifert
  • 145,886
  • 38
  • 333
  • 352
FAndrew
  • 248
  • 4
  • 22
  • Please share [mcve] – T J Jul 12 '16 at 07:37
  • Possible duplicate of [jQuery UI : Combining Selectable with Draggable](http://stackoverflow.com/questions/5430815/jquery-ui-combining-selectable-with-draggable) – T J Jul 12 '16 at 07:41
  • I don`t think cause its duplicate for me it works perfect together, the problem is just I need to obtain in event when the component is unselected after action I described above. – FAndrew Jul 12 '16 at 08:29

1 Answers1

0

I find my method, on action described above enters in the Draggable.start event and the previous component is still selected.

FAndrew
  • 248
  • 4
  • 22