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

Re: Issues with Drag and Drop

Expand Messages
  • Scott Stroz
    Anyone? ... -- Scott Stroz Senior Developer AboutWeb, LLC http://www.aboutweb.com
    Message 1 of 3 , Apr 3, 2007
    • 0 Attachment
      Anyone?

      On 4/2/07, Scott Stroz <boyzoid@...> wrote:
      I am building an app where HTML elements are returned from an AJAX call and then added to the innerHTML of a <div>.

      After they are returned, I want to make the elements dragable.  This works wonderfully for the first element returned, however, after other elements are added, the previously added element loses its ability to be dragged and dropped.

      Here is a snippet of code used inside the method which handles the AJAX result:

      //add the HTML that is returned
      screenbuilder.innerHTML +=cleanData;

      //get the actaul DOM element that was returned
      newTargetDiv = Dom.get(targetDiv.id);

      //add images for drag ahndle
      var handleDiv = " <span class=\"hide\" id=\"handle"+newTargetDiv.id+"
      \" ><img id=\""+newTargetDiv.id+"innerDrag\" src=\"images/move.png\" title=\"Move element\" /></span>"
                              newTargetDiv.innerHTML += handleDiv;

                              dd = new YAHOO.util.DD(newTargetDiv.id);
                              ddsetYConstraint(2000, 2000, 5);
                              dd.setXConstraint(2000, 2000, 5);
                              dd.setHandleElId(newTargetDiv.id+"innerDrag");

      I have also tried this:

      //add the HTML that is returned
      screenbuilder.innerHTML +=cleanData;

      //get the actaul DOM element that was returned
      newTargetDiv = Dom.get(targetDiv.id);

      //add images for drag ahndle
      var handleDiv = " <span class=\"hide\" id=\"handle"+newTargetDiv.id+"\" ><img id=\""+newTargetDiv.id+"innerDrag\" src=\"images/move.png\" title=\"Move element\" /></span>"
                              newTargetDiv.innerHTML += handleDiv;

                              dd[newTargetDiv.id] = new YAHOO.util.DD(newTargetDiv.id);
                              dd[newTargetDiv.id].setYConstraint(2000, 2000, 5);
                              dd[newTargetDiv.id] setXConstraint(2000, 2000, 5);
                              dd[newTargetDiv.id].setHandleElId(newTargetDiv.id+"innerDrag");

      And I get the same behavior.

      Once again, this works for the element just created, but it disables/breaks the drag/drop capability of the previously created element.

      Thanx in advance for any help/guidence.


      --
      Scott Stroz
      Senior Developer
      AboutWeb, LLC
      http://www.aboutweb.com



      --
      Scott Stroz
      Senior Developer
      AboutWeb, LLC
      http://www.aboutweb.com
    • dav.glass@yahoo.com
      Scott -- Can you post an url to a working example? It would be easier to debug if we could see the issue in action :) Dav Dav Glass dav.glass@yahoo.com
      Message 2 of 3 , Apr 3, 2007
      • 0 Attachment
        Scott --

        Can you post an url to a working example?

        It would be easier to debug if we could see the issue in action :)

        Dav
         
        Dav Glass
        dav.glass@...
        blog.davglass.com


        + Windows: n. - The most successful computer virus, ever. +
        + A computer without a Microsoft operating system is like a dog
        without bricks tied to its head +
        + A Microsoft Certified Systems Engineer is to computing what a
        McDonalds Certified Food Specialist is to fine cuisine +


        ----- Original Message ----
        From: Scott Stroz <boyzoid@...>
        To: ydn-javascript@yahoogroups.com
        Sent: Tuesday, April 3, 2007 5:46:51 AM
        Subject: [ydn-javascript] Re: Issues with Drag and Drop

        Anyone?

        On 4/2/07, Scott Stroz <boyzoid@...> wrote:
        I am building an app where HTML elements are returned from an AJAX call and then added to the innerHTML of a <div>.

        After they are returned, I want to make the elements dragable.  This works wonderfully for the first element returned, however, after other elements are added, the previously added element loses its ability to be dragged and dropped.

        Here is a snippet of code used inside the method which handles the AJAX result:

        //add the HTML that is returned
        screenbuilder.innerHTML +=cleanData;

        //get the actaul DOM element that was returned
        newTargetDiv = Dom.get(targetDiv.id);

        //add images for drag ahndle
        var handleDiv = " <span class=\"hide\" id=\"handle"+newTargetDiv.id+"
        \" ><img id=\""+newTargetDiv.id+"innerDrag\" src=\"images/move.png\" title=\"Move element\" /></span>"
                                newTargetDiv.innerHTML += handleDiv;

                                dd = new YAHOO.util.DD(newTargetDiv.id);
                                ddsetYConstraint(2000, 2000, 5);
                                dd.setXConstraint(2000, 2000, 5);
                                dd.setHandleElId(newTargetDiv.id+"innerDrag");

        I have also tried this:

        //add the HTML that is returned
        screenbuilder.innerHTML +=cleanData;

        //get the actaul DOM element that was returned
        newTargetDiv = Dom.get(targetDiv.id);

        //add images for drag ahndle
        var handleDiv = " <span class=\"hide\" id=\"handle"+newTargetDiv.id+"\" ><img id=\""+newTargetDiv.id+"innerDrag\" src=\"images/move.png\" title=\"Move element\" /></span>"
                                newTargetDiv.innerHTML += handleDiv;

                                dd[newTargetDiv.id] = new YAHOO.util.DD(newTargetDiv.id);
                                dd[newTargetDiv.id].setYConstraint(2000, 2000, 5);
                                dd[newTargetDiv.id] setXConstraint(2000, 2000, 5);
                                dd[newTargetDiv.id].setHandleElId(newTargetDiv.id+"innerDrag");

        And I get the same behavior.

        Once again, this works for the element just created, but it disables/breaks the drag/drop capability of the previously created element.

        Thanx in advance for any help/guidence.


        --
        Scott Stroz
        Senior Developer
        AboutWeb, LLC
        http://www.aboutweb.com



        --
        Scott Stroz
        Senior Developer
        AboutWeb, LLC
        http://www.aboutweb.com

      Your message has been successfully submitted and would be delivered to recipients shortly.