[CLOSED] TreeViewDragDrop plugin on over event

  1. #1

    [CLOSED] TreeViewDragDrop plugin on over event

    Hello.

    I am trying to use a TreeViewDragDrop plugin for nodes reordering. I have nodes of different types, and nodes of one type could not be dropped to nodes of other type. I was abble to implement this using BeforeDrop listener (I return false, when types are different). However I did not find any way to show user, that this drop operation is not allowed (no Over listener).

    Could you suggest a way to solve this issue?

    Best regards.
    Last edited by Daniil; Sep 12, 2012 at 2:47 PM. Reason: [CLOSED]
  2. #2
    Hi Leonid,

    Unfortunately, there is no built-in option to change this behavior.

    But I can suggest to override the isValidDropPoint function of the ViewDropZone class.
    http://docs.sencha.com/ext-js/4-1/so...ValidDropPoint

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    
        <script type="text/javascript">
            var onAfterRender = function (view) {
                var dz = view.getPlugin("dragdrop").dropZone;
    
                dz.isValidDropPoint = Ext.Function.createInterceptor(dz.isValidDropPoint, function (node, position, dragZone, e, data) {
                    return false; // please implement as you need  
                }); 
            };
        </script>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        
        <ext:TreePanel runat="server">
            <Root>
                <ext:Node Text="Root (level 0)" Expanded="true">
                    <Children>
                        <ext:Node Text="Node1 (level 1)" Expanded="true">
                            <Children>
                                <ext:Node Text="Node1 (level 2)" Expanded="true">
                                    <Children>
                                        <ext:Node Text="Node1 (level 3)" Leaf="true" />
                                        <ext:Node Text="Node2 (level 3)" Leaf="true" />
                                    </Children>
                                </ext:Node>
                            </Children>
                        </ext:Node>
                    </Children>
                </ext:Node>
            </Root>
            <View>
                <ext:TreeView runat="server">
                    <Plugins>
                        <ext:TreeViewDragDrop PluginId="dragdrop" runat="server" />
                    </Plugins>
                    <Listeners>
                        <AfterRender Fn="onAfterRender" />
                    </Listeners>
                </ext:TreeView>
            </View>
        </ext:TreePanel>
    </body>
    </html>
  3. #3
    Thank you, Daniil. This works perfect.
  4. #4
    You may be interested to look at this example.
    http://examples2.ext.net/#/TreePanel...om_Drop_Logic/

Similar Threads

  1. Replies: 6
    Last Post: Sep 22, 2011, 1:46 PM
  2. Replies: 2
    Last Post: Jun 16, 2011, 2:41 AM
  3. Replies: 1
    Last Post: Dec 22, 2010, 4:47 PM
  4. [CLOSED] TabCloseMenu plugin firing close event
    By Justin_Wignall in forum 1.x Premium Help
    Replies: 2
    Last Post: Jul 28, 2010, 1:18 PM
  5. New Plugin
    By Maia in forum User Extensions and Plugins
    Replies: 4
    Last Post: Jun 16, 2009, 1:24 AM

Tags for this Thread

Posting Permissions