Drag and drop causing expansion

4 posts, 0 answers
  1. Chad Johnson
    Chad Johnson avatar
    54 posts
    Member since:
    Sep 2012

    Posted 18 Aug 2011 Link to this post

    Greetings,

    I'm currently working on a project that has both a source and destination folder set of folders.  Both load only the root folders to begin with.  Whenever the user drags one over from the source to the destination, if the user drops it on another folder, it should force the folder to expand.

    There is a slight issue with the expansion.  I have the expansion using a web method and know for a fact that the expansion happens when you hover over the node.  However, the issue is that the expansion doesn't happen fast enough for some users.  They just drop the node before the expansion happens.  Is there a way to make the drag and drop wait until the expansion is done first?

    Kindest Regards,
    Chad Johnson
  2. Plamen
    Admin
    Plamen avatar
    3040 posts

    Posted 22 Aug 2011 Link to this post

    Hello Chad,

    Here is one way to make the node expand as fast as you want setting a Timeout:
    function OnClientMouseOver(sender, args) {
              
                   var node = args._node;
                   if (node.get_nodes().get_count() > 0) {
     
                       window.setTimeout(function () {
                           node.expand();
                       }, 1000);
                   };
               }
     
    Hope this will help.

    Kind regards,
    Plamen Zdravkov
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  3. Chad Johnson
    Chad Johnson avatar
    54 posts
    Member since:
    Sep 2012

    Posted 22 Aug 2011 Link to this post

    This was somewhat helpful.  I tried this piece of code out and got a partial bit of success.  If the user pauses and doesn't release the node they dragged over, the expansion happens.  However, when the user just drags it over and let's go, the drop method on the client side seems to fire regardless.  I need to slow this down somehow.

    Ex.  User grabs a node on the source tree.  User drags it to destination tree and drops it without waiting for tree to expand.  A confirmation box asking if user is sure they want to copy this folder pops up.  Once you cancel or say okay, node expands.  By then it is too late for the logic to properly stop this drop from happening.
  4. Plamen
    Admin
    Plamen avatar
    3040 posts

    Posted 25 Aug 2011 Link to this post

    Hi Chad,

    You can consult with the Drag and Drop demo where all the client events best practices are shown and you can choose exactly where to add this confirmation.

    Kind regards,
    Plamen Zdravkov
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Back to Top