1

I have a html structure like this

<div id='dropzone'>
<ul id='filelist'>
<li class='fileitem'></li>
<li......
....
....
</ul>
</div>

Jquery UI droppables are

$('#dropzone').droppable();
$('.fileitem').droppable({greedy:true});

Dropping files on dropzone working fine. Now my problem is i would like to drop a fileitem on another fileitem it is not working, when i try to do this it treats like i am dropping fileitem on dropzone.

kirankumar
  • 191
  • 1
  • 2
  • 13

1 Answers1

1

I've made a little demo. It is not about files as you don't have problem with them, but it is about draggables and droppables, including greedy droppables.

I suppose you create your li elements dynamically, so don't forget to dynamicaly initialize them with droppable() call. Note the initLIObject function which is called not only on static li objects, but also on dynamically created li objects.

EDIT1: have a look at this question and this one

Community
  • 1
  • 1
Anton Boritskiy
  • 1,539
  • 3
  • 21
  • 37
  • Thanks for your help! but i need drop the file item on on another. – kirankumar Aug 04 '12 at 12:05
  • I need some more help. Please look at the fiddle example and I want to delete the dropped file item and When i dropped the fileitem on dropzone it creating another fileitem, avoid that. – kirankumar Aug 04 '12 at 12:18
  • rajuk, I don't understant how the application should work, could please describe the desired logic in detail. – Anton Boritskiy Aug 04 '12 at 12:25
  • see EDIT in answer, it looks like jquery-ui is not able to handle files ((( – Anton Boritskiy Aug 04 '12 at 12:28
  • Thank you very much you solved my problem and i need one final help look at the example when i dropped a fileitem on other fileitem the dropped item should me remove. – kirankumar Aug 04 '12 at 12:45
  • 1
    If I understand you right you need to remove
  • objects depending on what object was dropped above them. I modified the demo to show this behaviour [check this out](http://jsfiddle.net/tonybo/f5EbX/82/). If you drop green square above red zone the blue blocks will be created. If you drop green block above blue one, the blue block will change its color. If you drop the magenta block above blue block the blue one will be deleted.
  • – Anton Boritskiy Aug 04 '12 at 20:29