1. #1
    Sencha User
    Join Date
    Sep 2010
    Posts
    41
    Vote Rating
    0
    Answers
    1
    gfrancis1@gmail.com is on a distinguished road

      0  

    Default Unanswered: Tree View - referring to Nodes programatically

    Unanswered: Tree View - referring to Nodes programatically


    I have defined a TreeView, and when it gets rendered to the HTML page, the first element is a DIV with the id of my TreeView:

    Code:
    <div id="levelTreePanel" class="x-panel x-tree-panel x-tree-lines x-grid x-grid-header-hidden x-panel-default" style="height: 120px; width: 320px; " role="presentation">
    ...
    </div>
    There are some nested DIVs under that, with Id's like 'treeview-xxxx' and 'ext-genxxxx'
    Then there's a TABLE
    In cells of the table are Divs that render each of the Nodes in my Tree data.
    I would like to be able to reference these Divs that represent my Nodes from Javascript, but the generated Node-Divs don't have Ids at all. I've tried assigning 'id' attributes to the nodes of the Tree data, but these don't get rendered anywhere on the resulting HTML.

    Is there a way to get the framework to assign Id values to the Nodes of the tree?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,641
    Vote Rating
    434
    Answers
    3107
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    What are you actually trying to accomplish?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    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 almost in print!

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

  3. #3
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Vote Rating
    101
    Answers
    343
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    Try this:
    Code:
    function getDivRef (nodeId){ // nodeId is record Id
        var divRef = null;
        var node = treeStore.getNodeById(nodeId);
        node = treePanel.getView().getNode(node);
        if(node){
            divRef = Ext.fly(node).down('div');
        }
        return divRef;
    }

Tags for this Thread