cancel
Showing results for 
Search instead for 
Did you mean: 

set current node

Former Member
0 Kudos

I got a table with nodes with the context:

Person

- ID

- Name

All the nodes is listed in a table in dynpro. My problem is that i want a certain node default selected in the table. All i know is the ID of the node. Got any suggestion of how to do this?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Kristoffer,

What do you mean by <b>nodes</b>? Are you talking about value node which we create through context or is it something else. The code i have given is for a value node Person which will be mapped with the datasource property of the table and it contains two attributes ID and Name.

So please explain on your scenario.

Regards,

Jaydeep

Former Member
0 Kudos

Yes, Its a valuenode that is created in the context.

Lets say you have this context: Persons (node)

Name (value attribute), ID (value attribute)

This is binded to a table, that could look like this:

1 K.E

2 O.C

3 L.A

In dynpro tables you can set one row to be selected.

I get an ID as an input paramter i.e 2. Then i want the row with the ID 2 to get selected. If thats not possible, i want to set the the row with the ID 2 on top.

Former Member
0 Kudos

Hi Kristofer,

Let us say you have the value to be checked in a string 'str'.

IPrivate<View_name>.IPersonsElement elmt;

for(int i=0;i<wdContext.nodePersons().size();i++)

{

elmt = wdContext. nodePersons().getPersonsElementAt(i);

if(elmt.getID().equals(str);

{

wdContext. node<node_name>().setLeadSelection(i);

break;

}

}

Hope this helps you,

Best Regards,

Nibu.

Former Member
0 Kudos

Thanx... I tried it now, but it doesnt seem to work.

The node that is selected the first time, is selected every time i go to the table with the nodes.

I.E i select row 2 in the table, and go out.. go back to the table and the row 2 is selecten.. even that it the input paramter is something else..

Former Member
0 Kudos

But in this if statement:

if(elmt.getID().equals(str);

{

wdContext. node<node_name>().setLeadSelection(i);

break;

}

}

How can i set the node it finds to be the startnode?

Former Member
0 Kudos

Thanx man.. i had some trouble with my contex. But it works now, and your code solved my problem. Thanx man!

Answers (1)

Answers (1)

Former Member
0 Kudos

hi Kristoffer,

U can use the following peice of code

 wdcontext.nodePersonNode().currentPersonNodeElement().setCurrentID("<Your Default ID>");

Regards,

Jaydeep

Former Member
0 Kudos

But that code changes the ID for the current person.

I dont know which node it is. All i have is a list of nodes, and a certain ID. The node that the certain ID belongs to, is the node i want to be selected.