Problem with Sortable.create and the "only" option

Hi,

I have the following issue :
I have 2 classes of elements which can be dragged/dropped - lineitem and
mandatorylineitem.

I have 2 goups - optional and mandatory. I do not want the mandatory
items to be dragged and dropped into the optional group. I create the
Sortables in the following manner :

Sortable.create(‘group_1’,{tag:‘div’,dropOnEmpty: true, containment:
[‘group_2’],only:[‘mandatorylineitem’,‘lineitem’]});

Sortable.create(‘group_2’,{tag:‘div’,dropOnEmpty: true, containment:
[‘group_1’],only:‘lineitem’});

But, to no avail. Could someone help me regarding this. Probably I
havent understood the meaning of the “only” option for Sortable.create.

Solved. Used the following :

	var draggedElement;
	Sortable.create('group_1',{tag:'div',dropOnEmpty: true, containment: 

[‘group_2’],only:‘lineitem’,onUpdate: function(element) {
var htmlElement = element.innerHTML
if(htmlElement.indexOf(’(Mandatory Attachment)’) != -1){
$(‘group_2’).appendChild(draggedElement);
}}, onChange: function(ele){
draggedElement = ele;
}});

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs