adambullmer
adambullmer

Reputation: 1012

Manually trigger receive event for jquery-ui sortable

Here's a working demo of my code so far.

When you drag into the open space, an empty group will be created. I may be going about this the wrong way, but I would like the item that is dragged to the new group to be populated into the list. Is there a way to call the receive event from the jquery-ui sortables widget to achieve this.

Alternately, should I prepopulate the group that is being added with the item un the drop method of the droppable item

drop: function (event, ui){
    $(element).append($(ui.helper).clone());
}

or something like that?

Upvotes: 3

Views: 2742

Answers (1)

Joshua Robinson
Joshua Robinson

Reputation: 3563

You can manually trigger a sortable event by using jQuery's .trigger() event like so:

$('#sortable-name').trigger('sortreceive');

I do think your code looks a bit strange, but that is perhaps because I have never seen someone use jQuery UI in a widget format.

Josh

Upvotes: 2

Related Questions