If you're having difficulties distinguishing between clones create a
better helper.
$("#item").draggable({
helper: function(){
return '<div style="background-color: orange; padding: 2px;"
class="dClassDrop">' + $(this).text() + '</div>';
}
});
So then you can distinguish between a helper and the actual item by $
(".dClassDrop")
On Oct 9, 12:11 pm, Bojan Mihelac <[email protected]> wrote:
> Anyone?
>
> On Oct 7, 11:35 pm, Bojan Mihelac <[email protected]> wrote:
>
> > Hi all,
>
> > I am first time posting on this list and hope to get and give some
> > answers.
>
> > I have connected sortable lists and draggable objects that are
> > connected to the lists. Now,what I am trying to achive is that each of
> > this lists receive items only if some conditions are meet. If
> > conditions are not meet item should be returned to sender list or
> > destroyed if it is draggable clone.
>
> > I made some code that is working, but I feel that it could be
> > improved. Here is the excerpt of the code:
>
> > $(".sortable").sortable({
> > connectWith: ".sortable",
> > stop: function(event, ui) {
> > if (ui.item.hasClass('draggable') && !canAddElement(this)) {
> > ui.item.remove();
> > }
> > },
> > receive: function(event, ui) {
> > if (!canAddElement(this)) {
> > $(ui.sender).sortable('cancel');
> > }
> > }
> > });
>
> > First I am not sure how to check if the ui.item is draggable clone or
> > item from another list so I checked className.
> > Also I have impression that this could be handled more elegant and
> > probably efficient.
> > Other choise I consider was to disable lists on fly so they do not
> > serve as dropables but was not successful.
>
> > For this case I created minimal
> > example:http://source.mihelac.org/playground/test-reject-draggables.html
>
> > I would appreciate your thoughts, ideas or good link to explore more.
>
> > Bojan Mihelac
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---