[ 5 posts ]

Amy

  • Username: amykhar
  • Joined: Thu Aug 13, 2009 9:19 am
  • Posts: 32
  • Twitter: amykhar
  • Offline
  • Profile

Two Drag and Drop Elements Within One Table Cell or Div

Post Posted: Fri Sep 18, 2009 7:10 am
+0-
Using the latest YUI release as of yesterday - When I put more than one Drag and Drop Element in the table cell or div, the first one is always undraggable.

The HTML looks like:

Code:
<td width="14%" id="table_calendar_div1_1_4" style="border: 1px solid black; height: 100px;">
     <span id="calendar_div1S09_10_2009" style="padding: 5px; height: 100%; width: 100%;">
           10<br/>
          <span id="span_78"> + <a style="color: rgb(255, 0, 153);" href="http://zmr/index.php?module=lms&amp;func=edit&amp;instance=78" id="link_78">Donald Brady  </a></span>
<br/>
<span id="span_82"> + <a style="color: rgb(255, 0, 153);" href="http://zmr/index.php?module=lms&amp;func=edit&amp;instance=82" id="link_82">Default Test  </a></span>
</span>
</td>


My class, which extends YAHOO.util.DD takes the span id for the span around each link as its container id. Example from this code would be span_78 and span_82

In the above example if I put an alert in the init function for the creation of the DD object, it alerts twice. Once for span_78. Once for span_82. However, span_78 is never draggable. Only span_82. If a single DD object is placed within a cell, it always is draggable.

In the above example, the table cell id gives me the row and column of the cell. The outer span id gives me the calendar date for that cell. The inner spans wrap around links for calendar events that I am using drag and drop to reschedule.

Amy

Dav Glass

  • Username: davglass
  • Joined: Thu Aug 28, 2008 9:28 am
  • Posts: 2088
  • Location: Marion, IL, US
  • Twitter: davglass
  • GitHub: davglass
  • Gists: davglass
  • IRC: davglass
  • Offline
  • Profile

Re: Two Drag and Drop Elements Within One Table Cell or Div

Post Posted: Fri Sep 18, 2009 7:53 am
+0-
Please post a link to a valid repro case..

Amy

  • Username: amykhar
  • Joined: Thu Aug 13, 2009 9:19 am
  • Posts: 32
  • Twitter: amykhar
  • Offline
  • Profile

Re: Two Drag and Drop Elements Within One Table Cell or Div

Post Posted: Fri Sep 18, 2009 8:16 am
+0-
http://amy.sleeplms.net/index.php?module=calendar

Dav Glass

  • Username: davglass
  • Joined: Thu Aug 28, 2008 9:28 am
  • Posts: 2088
  • Location: Marion, IL, US
  • Twitter: davglass
  • GitHub: davglass
  • Gists: davglass
  • IRC: davglass
  • Offline
  • Profile

Re: Two Drag and Drop Elements Within One Table Cell or Div

Post Posted: Fri Sep 18, 2009 8:41 am
+0-
The first one doesn't work because you are killing it's listeners with an innerHTML call:

Note the innerHTML call here:

Code:
datecell.innerHTML = cellHTML + '<br />' + linkstring;


When this is called, the first time, it's good because there is no element to destroy. The second time it's called (in your 2 event case), the innerHTML call is wiping the old element and it's listeners and placing a new one in the cell..

That would also be why the one that doesn't drag also doesn't have a tooltip showing..

Hope that helps..

Amy

  • Username: amykhar
  • Joined: Thu Aug 13, 2009 9:19 am
  • Posts: 32
  • Twitter: amykhar
  • Offline
  • Profile

Re: Two Drag and Drop Elements Within One Table Cell or Div

Post Posted: Fri Sep 18, 2009 8:45 am
+0-
Yes, thank you, it does.

Amy
  [ 5 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum