[CLOSED] Raising ItemMove when reordering a node into not loaded node

  1. #1

    [CLOSED] Raising ItemMove when reordering a node into not loaded node

    Hi folks, i have already had some problems when reordering a node, described in the following thread: http://forums.ext.net/showthread.php...t%B4s-children

    and after testing it better a found another issue.

    Take a look in the following structure:
    • root 1
      • sub 1
      • sub 2
      • sub 3

    • root 2
    • root 3


    if sub 1 is moved into root 2, which is not loaded/expanded yet, the ItemMove event is not raised.

    I need that this event is raised because i need to refresh the order column, shown in my TreePanel (not in this sample).

    <ext:TreePanel ID="TreePanel2" runat="server" Title="Remote Move vs Remote Load"
        Height="700" Width="400" Margins="10" Border="false" Mode="Remote" RemoteMoveUrl="/Example/MoveNode">
        <Store>
            <ext:TreeStore ID="TreeStore1" runat="server">
                <Proxy>
                    <ext:AjaxProxy Url="/Example/LoadFakeChildren">
                        <ActionMethods Read="POST" />
                        <Reader>
                            <ext:JsonReader Root="data" />
                        </Reader>
                    </ext:AjaxProxy>
                </Proxy>
            </ext:TreeStore>
        </Store>
        <Root>
            <ext:Node NodeID="0" Text="Root" />
        </Root>
        <Fields>
            <ext:ModelField Name="Task" />
        </Fields>
        <ColumnModel>
            <Columns>
                <ext:TreeColumn ID="TreeColumn1" runat="server" Text="Task" Flex="2" Sortable="true"
                    DataIndex="Task" />
            </Columns>
        </ColumnModel>
        <View>
            <ext:TreeView ID="TreeView1" runat="server" TrackOver="true">
                <Plugins>
                    <ext:TreeViewDragDrop ID="TreeViewDragDrop1" AllowLeafDrop="true" runat="server" />
                </Plugins>
            </ext:TreeView>
        </View>
        <Listeners>
            <ItemMove Handler="def()" />
        </Listeners>
    </ext:TreePanel>
    <script type="text/javascript">
        var def = function () {
            alert('def');
        }
    </script>
    public ActionResult MoveNode(string[] ids, string targetId, string point)
    {
        object r = new { actionSuccess = true };
    
        return Content(JSON.Serialize(r), "json/application");
    }
    
    public StoreResult LoadFakeChildren()
    {
        NodeCollection nodes = new NodeCollection(false);
    
    
        for (int index = 1; index < 6; index++)
        {
            Node no = new Node();
            no.NodeID = index.ToString() + DateTime.Now.Second;
            no.CustomAttributes.Add(new ConfigItem { Name = "Task", Value = no.NodeID, Mode = ParameterMode.Value });
            nodes.Add(no);
        }
    
        return new StoreResult { Data = nodes.ToJson() };
    }
    Last edited by Daniil; Jun 20, 2012 at 7:36 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Confirm, thanks for the report. We will investigate.
  3. #3
    When you drop a node to not expanded node then real moving is not performed (if Remote mode is used).
    Dropped node will be added with all children after expand (if return that node from a server, of course)

    Therefore refresh anything is based on that node has no sense because the node has no children until its expanding
    I suggest to call the same code (as in ItemMove) in Load event

    <ItemMove Handler="def()" />
    <Load Handler="def()" />
  4. #4
    Take a look in the following structure:
    • Name -------------- Order
    • root 1 -------------- 1
      • sub 1 ------- 1
      • sub 2 ------- 2
      • sub 3 ------- 3
    • root 2 -------------- 2
    • root 3 -------------- 3


    if i reorder sub 2 into root 2 it will appear like this:

    • Name -------------- Order
    • root 1 -------------- 1
      • sub 1 ------- 1
      • sub 3 ------- 3
    • root 2 -------------- 2
      • sub 2 ------- 1
    • root 3 -------------- 3


    but i need that it appears like this

    • Name -------------- Order
    • root 1 -------------- 1
      • sub 1 ------- 1
      • sub 3 ------- 2
    • root 2 -------------- 2
      • sub 2 ------- 1
    • root 3 -------------- 3


    it would be nice to raise ItemMove event after the load/expand process is complete.
  5. #5
    I guess that if remote mode is used then it is better to use remote success for move action
    Try to add the following listeners to a tree
    <RemoteActionSuccess Handler="if(action == 'raMove'){alert('Node:'+o.node.id);}" />
  6. #6
  7. #7
    Please update from SVN and retest,
    Now ItemMove should be fired after a target node children are loaded
  8. #8
  9. #9
    Thank you Vladimir, now it works fine :)

    Please mark it as closed.

Similar Threads

  1. Replies: 0
    Last Post: Aug 09, 2012, 8:30 AM
  2. Replies: 2
    Last Post: Sep 22, 2011, 6:37 AM
  3. Replies: 16
    Last Post: Jul 19, 2011, 3:53 AM
  4. Replies: 1
    Last Post: Nov 24, 2010, 3:04 PM
  5. TreePanel:Copying from one node to another node using drag and drop
    By eighty20 in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Jan 25, 2009, 7:48 AM

Posting Permissions