1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    31
    Vote Rating
    0
    yo_haha is on a distinguished road

      0  

    Default Get TreeNode anchor

    Get TreeNode anchor


    Hi,

    I have a TreePanel with a root child and grand-child:
    Code:
        tree = new Ext.tree.TreePanel({
            useArrows: true,
            animate: true,
            title: "Couches",
            enableDD: true,
            root: {
                nodeType: "async",
                expanded : true,
                children: [{
                        text: 'Fond de plan',
                        checked: true,
                        draggable: false,
                        leaf: false,
                        expanded: true,
                        singleClickExpand: true,
                        children: [{
                            text: 'Open Street Map',
                            draggable: true,
                            checked: true,
                            leaf: true,
                            listeners:{
                                'checkchange': function(node, checked){
                                        osm.setVisibility(checked);
                                }
                            }
                        }]
                        ,listeners:{
                            'checkchange': function(node, checked){
                                node.eachChild(function(n) {
                                    n.getUI().toggleCheck(checked);
                                });
                            }
                        }
                    }     
                ]
            },
            border: true,
            region: "south",
            height: 300,
            split: true,
            autoScroll: true,
            containerScroll: true,
            rootVisible: false,
            lines: false
        });    
        tree.getRootNode().expand();
        tree.getRootNode().expandChildNodes();
    When I call the method:
    Code:
       tree.getRootNode().firstChild.firstChild.text;
    I get the expexted answer : Open Street Maps.
    And when I call:
    Code:
        tree.getRootNode().firstChild.firstChild.getUI();
    I get the UI object as an answer.
    but when I call:
    Code:
     tree.getRootNode().firstChild.firstChild.getUI().getEl();
    or
    Code:
     tree.getRootNode().firstChild.firstChild.getUI().getAnchor();
    I get undefined as an answer.
    When I try:
    Code:
     tree.getRootNode().firstChild.firstChild.getUI().hide();
    The treeNode hides from the UI as expected.

    Is there a way to get the anchor element of the treeNode?

    Regards.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,327
    Vote Rating
    850
    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


    Just tried it on an example and it worked for me.
    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.

  3. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    31
    Vote Rating
    0
    yo_haha is on a distinguished road

      0  

    Default


    Did you try the same example I provided?
    Could you please post your example so I can compare?

    Thanks.

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,327
    Vote Rating
    850
    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


    I tried with the check tree example that comes with Ext JS 3
    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.

  5. #5
    Sencha User
    Join Date
    Oct 2012
    Posts
    31
    Vote Rating
    0
    yo_haha is on a distinguished road

      0  

    Default


    I'm a bit lost...
    I copied my tree into an empty html file and rendered the tree to a div. I get no problem with tree.getRootNode().firstChild.firstChild.getUI().getAnchor()
    It returns the object I want.
    But inside the original file with the rest of the application code, tree.getRootNode().firstChild.firstChild.getUI().getAnchor() returns "undefined".
    Is this normal ?

Thread Participants: 1

Tags for this Thread