1. #1
    Sencha Premium Member
    Join Date
    Oct 2011
    Posts
    55
    Answers
    4
    Vote Rating
    0
    dwb is on a distinguished road

      0  

    Default Answered: Tree Panel: Add Child(folder) then add grandchild(leaf) to that child folder

    Answered: Tree Panel: Add Child(folder) then add grandchild(leaf) to that child folder


    Hi,
    I'm working with a tree panel that has the drag & drop plugin configured in it's view.

    When a user clicks a button, I've successfully added a new, "non-leaf" type node to my root node using appendChild({}). Next, I have another button that adds a new "leaf"type node. Now I have two different types of node, both children of the root node.

    What I'd like is for the new "leaf"type node to be created with in the last "non-leaf" type node that's been added. Also, I would like to constrict the "non-leaf" type nodes to only be able to be dropped into the 1st children (folders). In other words, I don't want leaf nodes to be able to be dropped to the root node. I want to allow leaf drops to the other non-leaf nodes

    Is this achievable?

  2. You should keep track of the last non-leaf node created so that when you create a leaf it will go to that tracked non-leaf node.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,812
    Answers
    3467
    Vote Rating
    835
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You should keep track of the last non-leaf node created so that when you create a leaf it will go to that tracked non-leaf node.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1

Tags for this Thread