Skip to Content

How to set the first node of a tree as selected by default


How do i set the first node of the tree by default? I want to set the first node of the tree to be selected

I tried , yardTree.fireSelect("node"); but it didnt work out

var yardTree = new sap.ui.commons.Tree({
select : [ function(oEvent) {
var control = oEvent.getSource();var nodeId = oEvent.getParameter("node").getId();//alert("nodeId::"+nodeId);var selectedYardNo = oEvent.getParameter("node").getText(); // alert("selectedYardNo::"+selectedYardNo); //call the odata }, this ]
for(var i=0;i<noOfNodes;i++){
var yardNo = oData.results[i].YardNo;
var node = new sap.ui.commons.TreeNode();
//selec the first node of the tree by default
var nodes [] = yardTree.getNodes();

Any help?



Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 21, 2013 at 07:58 AM

    Hi Sandip,

    Parameter type for method 'fireSelect' is an object.

    Instead of statement

    'yardTree.fireSelect(nodes[0]); '


    var map = {};

    map.node = nodes[0];


    Thanks and Regards, Venkatesh

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.