1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    3
    Vote Rating
    0
    dafeizhu is on a distinguished road

      0  

    Default Adding of treenode from SlaveTree to MasterTree

    Adding of treenode from SlaveTree to MasterTree


    Hi all,

    This is what I am trying to achieve in ExtJs 3.3.1:
    I have SlaveTreePanel and MasterTreePanel. All the nodes (from treeloader) in SlaveTree can be appended to a node in MasterTree. And I want the nodes in SlaveTree to remain after appending to MasterTree.


    This is the code for my listener in MasterTreePanel.
    Code:
    beforenodedrop: function (e){
    e.dropNode = e.tree.getLoader().createNode(e.dropNode.attributes);
    }
    This is working fine until I dragged the same node from SlaveTree into MasterTree twice.
    I have changed the attributes of the first node in MasterTree. And when i dragged the
    same node into MasterTree the 2nd time, it overwrites the attributes of the first node.

    Is there anyway I can do it? Or did i make some mistake in the listener above?
    Thanks in advance.

  2. #2
    Sencha User
    Join Date
    Apr 2012
    Posts
    3
    Vote Rating
    0
    dafeizhu is on a distinguished road

      0  

    Default


    Hi, have anyone encountered this before? I cannot seem to find a solution to this. Thanks

  3. #3
    Sencha User
    Join Date
    Jan 2011
    Posts
    546
    Vote Rating
    52
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      0  

    Default


    I'm no expert with tree menus combined with drag&drop, but if it overwrites the values when you drop the same node onto the master tree a second time, this would logically make me think you must be carrying over the same ID twice (hence it updates the values of an existing node)?

    When dropping a node onto the master tree, I would assume you should assign a new/unique ID each time.

    As I said, I'm no expert with these elements/methods, but that is what I would immediately investigate if I ran into this problem...

  4. #4
    Sencha User
    Join Date
    Apr 2012
    Posts
    3
    Vote Rating
    0
    dafeizhu is on a distinguished road

      0  

    Default


    Hi willigogs,

    thks for the reply. U r right!
    I thought i can change the node id simply by node.id = '123',
    I guess node.setId('123') is the correct method.
    Thanks again!

Thread Participants: 1

Tags for this Thread