This is a migrated thread and some comments may be shown as answers.

Drag and drop causing expansion

3 Answers 43 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Chad Johnson
Top achievements
Rank 1
Chad Johnson asked on 18 Aug 2011, 04:17 PM
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

3 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 22 Aug 2011, 02:01 PM
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 >>

0
Chad Johnson
Top achievements
Rank 1
answered on 22 Aug 2011, 04:58 PM
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.
0
Plamen
Telerik team
answered on 25 Aug 2011, 11:04 AM
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 >>

Tags
TreeView
Asked by
Chad Johnson
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Chad Johnson
Top achievements
Rank 1
Share this question
or