cancel
Showing results for 
Search instead for 
Did you mean: 

How to read the current selection in a table.

Former Member
0 Kudos

Hello Experts,

I've this issue with the web dynpro. I have a Adaptive Webservice Model in web dynpro. And I have three tables in the UI. When a row is selected in the first table, the second table is populated with the appropriate data (using a method in the web service.) the same applies to the third table, when the a row is selected in the second table, the third table has to be populated with the appropriate data. The methods in the web service are all working fine. However, in web dynpro, I am not able to figure out on how I read the selected row in a table. Any information on how to resolve this would be really really helpful.

<

wdContext.currentGetMailElement().setProfileID("-Should be read from the selected row in the table.");

wdThis.wdGetMailControllerController().executeGetMail();

>

regards,

Sam.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Samuel,

you can get the currently selected element via lead selection. Suppose your Node which you have binded to the table name is "TEST" then we can get the leasd selectd elemnt of the node by ..

wdContext.currenttestelement.get<Attrname>..

Similarly you can get the Leade selected element number by using

int l = wdContext.nodeTest().getLeadSelection();

This will return the Number of the element in the node which was lead selected.

Thanks,

Raju Bonagiri

Former Member
0 Kudos

Hi,

Thank you for your replies. They really were helpful.

The problem I have is this. My context controller structure is like this: Request_GetMail > Response_1>GetMailResponse>ProfileNames : profileid, profilename.

I am now able to get the lead selection, however, I am not able to read the profileid attribute.

Any reasons for this?

I'm using this structure to access my element in the table.

<

int lead = wdContext.nodeRequest_GetMail().nodeResponse().nodeGetMailResponse().nodeMail().getLeadSelection();

String profileID=wdContext.nodeRequest_GetMail().nodeResponse().nodeGetMailResponse().nodeMail().getElementAt(lead).getAttributeAsText("ProfileID");

>

thanks again for the help.

Cheers,

Sam.

Former Member
0 Kudos

Hi Samuel,

I didnt clearly understood your problem. When you are selecting a particular row in a table you are executing a web service named Get Mail. Are you passing any input parameter(any selected row data) while executing a web service. And when you get the response node where you have a attribute in the node getmail. Am I right.

If this is the case, then first check if the GetMail node is present or not by comparing it will null or checking its size. If the node is null then you will not get attribute as the element itself is null as nothing is retrieved in response. And if the node is not null then the element at 0th position is selected by default. you can retreieve the attribute by directly using the following code



if(wdContext.nodeGetMail() !=null)
{ 
    String profileId= wdContext.currentGetMailElement().getProfileID();
}

Check if this works for you.

Regards,

Ardhendu Sarkar

Former Member
0 Kudos

Hello,

Thank you Ardhendu, Himanshu, Raju for the help. I've resolved the issue.

~Sam

Former Member
0 Kudos

Hi SAM,

The code will return the Profile ID of the lead selction. But from ur reply it seems we are not getting the values. This means there might be the no data for the Profile ID of that particular row. Try printing the value of the String profile ID using the message manager.

wdcomponentAPI.getMessageManager.reportsucess("Profile ID" + ProfileID );

You can also access the attribute using

String profileID=wdContext.nodeRequest_GetMail().nodeResponse().nodeGetMailResponse().nodeMail().getMailElementAt(lead).getProfileID();

Thanks,

Raju Bonagiri

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Sam,

Do the following:

1. int lead = wdcontext.nodetable.getleadselection();

2. String profileID = wdcontext.nodetable,gettableelementat(lead).getprofileid();

3. wdContext.currentGetMailElement().setProfileID(profileID );

Regards,

Himanshu

Edited by: Himanshu K on Dec 10, 2009 3:23 PM

Former Member
0 Kudos

Hello,

For a table to select a particular row in a table there is a action defined onLeadSelect.

This select the particular element in the node and you can access all the attributes present in the element.

So when you select a particular row in table this action is called if you define it. In this action you can write the code to fetch the data from the web service or call a method in controller which fetches the data from the web service.

Regards,

Ardhendu Sarkar