thanks Brandon, but it looks like that stop and receive events in sortable does not have access to helper as it does not exists anymore.
best, Bojan On Oct 9, 10:37 pm, Brandon Ryall <brandon.ry...@emaint.com> wrote: > 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 <bmihe...@gmail.com> wrote: > > > > > Anyone? > > > On Oct 7, 11:35 pm, Bojan Mihelac <bmihe...@gmail.com> 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 jquery-ui@googlegroups.com To unsubscribe from this group, send email to jquery-ui+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en -~----------~----~----~----~------~----~------~--~---