View Full Version : Need help on Drag and Drop

20 Jul 2010, 12:32 PM

I really need help on Drag & Drop. I have a HTML5 page that I add 2 div elements, 1 with id="droppable" and the other id="draggable" like in the Drag&Drop example of Sencha-touch-beta-0.91. I define my own css for these two droppable and draggable elements. The problem is I can not drop the draggable div into the droppable div. It always goes back to the original position (because revert is set to true). It seems the div id=droppable can not hold the draggable div although validDropMode is set to contains in index.js. My HTML page also has ext-touch.css, ext-touch-debug.js, index.js, and I run the page in Chrome.

Any help is highly appreciated.

20 Jul 2010, 1:12 PM
I have done some more experiments! The draggable item can work when I add another div with id="invalid" like in the d&d example. I really don't understand why I have to have the "invalid" div so that drag&drop can work. I think this item in the example is just for the demo purpose. But how can I drag and drop the item in my page without adding the invalid item.

Another problem is what if my page need to have several draggable items (e.g photos in an album) and I want the user arranges items by dragging them around? Obviously these items can not share the same id="draggable". I look into javascripts and see that they all refer to the items by the id "draggable". In this case what can I do?

Thank you!