[CLOSED] TreePanel DragDrop

  1. #1

    [CLOSED] TreePanel DragDrop

    Hi! I'm trying to port the following v5 code to v7.
    I cannot find the ItemMove listener.

            <ext:TreePanel
                ID="TreePanel1"
                runat="server"
                Height="300"
                Width="250"
                UseArrows="true">
                <Listeners>
                    <ItemMove Fn="moveNode" Delay="1" />
                </Listeners>
                <View>
                    <ext:TreeView runat="server">
                       <Plugins>
                           <ext:TreeViewDragDrop runat="server" ContainerScroll="true" />
                       </Plugins>
                    </ext:TreeView>
                </View>
            </ext:TreePanel>
    this code becomes from this sample: https://examples5.ext.net/#/TreePane...Reorder_Nodes/

    could you please help me?
    Last edited by fabricio.murta; Aug 08, 2022 at 7:24 PM.
  2. #2
    Hello @bbros!

    Plugin listeners aren't always available to the component and currently Ext.NET 7 has no means to tell them apart. In that case, you'd need to wrap the listeners in customConfig blocks. Something like this:

    <customConfig>
        <ext-add key="listeners">
            <ext-add key="itemmove">
                <ext-add key="delay" value="1" />
                <ext-add key="fn" value="moveNode" mode="Raw" />
            </ext-add>
        </ext-add>
    </customConfig>
    Beware if you have other <listener></listener> blocks in the same component they'll be completely overridden by the custom one. So once you add one custom listener, you'll need to move the other listeners to the CustomConfig block.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Thank you for the suggestion.
    I'm working in codebehind, so my implementation is
                tree.CustomConfig = new JsObject()
                {
                    { "listeners", new JsObject()
                        {
                            { "itemmove", new JsObject()
                                {
                                    { "delay", 1 },
                                    { "fn", new JsObject("moveNode", ParameterMode.Raw) }
                                }
                            }
                        }
                    }
                };
    Last edited by bbros; Aug 02, 2022 at 3:45 PM.
  4. #4
    Hello @bbros!

    Can you provide a test case so we can test and be able to tell what's wrong with your approach?

    Looking forward to your follow-up!
    Fabrício Murta
    Developer & Support Expert
  5. #5
    I just want to share the codebehind-version of your suggestion; this is working fine, thanks!

    Maybe I'll need help about the treepanel, because the tree doesn't allow me to drop a node over a root node; anyway I created a simple repro-project which is working; I'll do my checks and in case I've been struggling too long I'll try to ask you an help!

    Thank you much, you can consider this thread as solved.
  6. #6
    Oh, alright! I have misread your response. It was a bit hard to tell whether the code snippet worked or not but, if you said it works for you, well, I don't see how it couldn't! :-)

    Thanks for sharing the approach that worked for you, and glad the tidbits we provided helped you find the solution!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. TreePanel DragDrop remoteMove
    By logplex in forum 2.x Help
    Replies: 8
    Last Post: Nov 21, 2013, 11:33 PM
  2. [CLOSED] DragDrop in treepanel using TreeViewDragDrop plugin
    By pawangyanwali in forum 2.x Legacy Premium Help
    Replies: 14
    Last Post: Apr 29, 2013, 4:36 AM
  3. [CLOSED] DragDrop Grid to Tree - treepanel re-ordering
    By Kev in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Apr 17, 2013, 8:45 AM
  4. DragDrop item information from TreePanel
    By Dominik in forum 2.x Help
    Replies: 1
    Last Post: Jun 01, 2012, 9:31 AM
  5. Replies: 1
    Last Post: Apr 24, 2012, 10:27 AM

Posting Permissions