Loading ...
Sorry, an error occurred while loading the content.

Drag and Drop issues

Expand Messages
  • mark
    var YAHOO = { Shortcuts : {}}; YAHOO.Shortcuts.hasSensitiveText = false; YAHOO.Shortcuts.sensitivityType = []; YAHOO.Shortcuts.doUlt = false;
    Message 1 of 1 , Mar 5, 2008
    • 0 Attachment
      If this is not the best place to post this (ie: you know of a better forum) please direct me there.

      So I'm trying to get a page working in a way that I want. I've achieved that but I feel its really ugly and not the best way to do it. I'm not the best in javascript so I can almost be confident its not the best.

      This is what I want my page to do (well, this is what it currently does, I'm trying to make it do more and I'll explain that in a second). It doesn't have to be in YUI its just what I found best suited at the time:

      A series of targets of two different types (ie: only a certain type of draggable can be dropped there).
      Dragging an item to the target copies the item into it. The new item can also be dragged. The old item returns to its normal position so it can be dropped elsewhere.

      Position does matter (ie: which item in which target). I also have it so one item to be used in multiple targets.

      Dragging an item off a target deletes it.

      Dragging an item from one target to another (that is compatible.. if its not, do nothing) changes its position. If something already occupies that target that item is deleted.

      Dragging an item from its default location to nothing just returns it.

      I'll post a link to my code below.

      Now my problem is that I have a few hundred items and I was planning on categorizing them into categories and then pages. Changing categories and pages keeps the already dropped items in their position.

      The way I'm doing it though doesn't really let it work too well though.

      Anyways, any suggestions would be really appreciated.

      Here is my current code. I am almost embarrassed to post it because I know its bad.

      The code is a modified version of http://developer.yahoo.com/yui/examp...dd-groups.html
      I used that as a base because it already did a lot of what I wanted it to do.

      Most of the code is just html setting up the example. The meat of the JS is at the top. The * in the draggables mean they can only be dropped in the center two targets.

      I also uploaded it online so you can actually see what I'm talking about without doing extra work: http://ggson.com/test.html

      Thanks if anyone responds to this!


      Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.


      Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
    Your message has been successfully submitted and would be delivered to recipients shortly.