cancel
Showing results for 
Search instead for 
Did you mean: 

Table Problem -- Lead Selection

Former Member
0 Kudos

Hi all,

I have a Table with four Columns.

First column cell editor is a LinktoAction Ui element and Other columns are TextView.

the selection cardinality of the table node is 0 to 1.

By default first row is selected .

Now when i click the linktoAction , it should navigate to another view where the Details of the Selected link is descriped.

Now my problem is , if the click the Second row LinkToAction(which is not selected), it is Showing the details of the Selected Row LinkToActrion (Ie details of first row).

Actually the Details are descriped only on the basis of key which is unique to the particlar Title.

help me in this issue.

Thanks and Regards

Fazal B

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Do the following in the wdDomodify


	  IWDLinkToAction linkToAction = (IWDLinkToAction)view.getElement("<Your Link to Action UI element");
	  linkToAction.mappingOfOnAction().addSourceMapping("nodeElement", "nodeElement");

if you are using CE then use the parameter mapping available as part of the menu when you right click on the UIelement from outline view.

Create a parameter of type Either IWDNodeElement(generic) or your NodeElement(IPrivate....) to action handler of your linktoAction.

Now your link to actionAction will look as follows


 public void onActionT(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, com.sap.tc.webdynpro.progmodel.api.IWDNodeElement nodeElement )
  {
    //@@begin onActionT(ServerEvent)
	  
	  //Now you can access all the attributes using This is a generic approach
	  nodeElement.getAttributeValue("<Your AttributeName>");

	  
    //@@end
  }

Regards

Ayyapparaj

former_member201361
Active Contributor
0 Kudos

hi,

I am really surprised about the Parameter mapping.

I think this will solve my issue.

Please retify me if i am wrong :

While creating an action for the Ui element , i have to add a parameter of type node element or Iprivate Node element of type Table node .

Finally do the parameter mapping between the Two actions

ie mapping the parameter from the Action to the Other action Listed in the OtherSide.

Now the Action will be having the Parameter.

One more Query.

I am getting the details of the particular title from the web service (In the Domodify method) .

here is it possible to get the Attribute which is set in the Action method.

Thanks and Regards

fazal

Former Member
0 Kudos

Hi,

I am getting the details of the particular title from the web service (In the Domodify method) .

here is it possible to get the Attribute which is set in the Action method.

If you could explain it in bit detail, it would be of help.

I would recomend to execute the webservice in init or some custom method and then populate a context attribute.

Use this context attribute binding to your UI element property.

Regards

Ayyapparaj

former_member201361
Active Contributor
0 Kudos

Hi Ayyaparaj,

Thanks for ur valuable support.

I have five Context Attributes (Title,Key,.........)for the table node .

I am getting the data from the Adaptive web service and populating the data to the Table (For every title attribute there will be a Unique key assigned to it).

Now When i click the Link , the Details View is populated based on the Key Attribute.

For doing this i have mapped the Table node to the component Controller and then to the details View.

The WebServices request object has an Input "Key" which has to given so that the particular title details will be displayed .

For doing this i am getting the "key" from CurrentContexttableNodeElement from the ComponentController. and excecuting the web services .

Every Thing works Fine .

Only problem is the Above Procedure works only for the Selected Row (As this is the current element).

Now to view the Other Title details , i have select the row then if i click the Link it is working fine.but this should not happen.

the link which i am selecting should be the Currenttablenode element.

Hope i am clear

Thanks and Regards

fazal

Former Member
0 Kudos

Hi,

If you do the source mapping and if the element contains your key even for your link to Action it will work fine.

Regards

Ayyapparaj

former_member201361
Active Contributor
0 Kudos

Hi Ayyaparaj,

Ya , it works fine .only problem which i have is , each and every time i have select the Row , then click the link to view the details of the Particular title.

For eg :

The first row is selected in the table by default .

if the selct the tile link it opens the details view .

This works .

Now :

The first row is selected in the table by default .

if i selct the second row title , it shows me the First row details view (Because the CurrentTableNodeElement is the Selected Row).

as in the details view , i am getting the key element as :

String key = wdThis.wdGetCompController().wdGetContext().currentTableNodeElement().getKey();

Please help me in this issue.

Thanks and Regards

fazal

Former Member
0 Kudos

Hi Fazal,

As I mentioned earlier if you do the source mapping and if Key is a attribute under the node that is bound to the table.

When you reference nodeElement in the below method you will get the key

Ex:


public void onActionT(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, com.sap.tc.webdynpro.progmodel.api.IWDNodeElement nodeElement )
  {
    //@@begin onActionT(ServerEvent)
	  
	  //Now you can access all the attributes using This is a generic approach
	 String key = (String) nodeElement.getAttributeValue("Key");
                wdComponentAPI.getMessageManager().reportSuccess(key);
	  
    //@@end
  }

Regards

Ayyapparaj

former_member201361
Active Contributor
0 Kudos

Hi Ayyaparaj,

Problem is not with the key .

I am able to get the key and execute the web services.

This works fine :

The first row is selected in the table by default .

if the select the tile link it opens the details view .

Now :

The first row is selected in the table by default .

if i selct the second row title , it shows me the First row details view (Because the CurrentTableNodeElement is the Selected Row).

as in the details view , i am getting the key element as :

String key = wdThis.wdGetCompController().wdGetContext().currentTableNodeElement().getKey();

here the current context element refers to the Selected table Row and not to the Link element.

Now if i make the selection mode to none .then no row is selected by default.

if i click the Link it throws me null pointer exception in the below line as the currentContextElement is null.

String key = wdThis.wdGetCompController().wdGetContext().currentTableNodeElement().getKey();'

Actually what i need is , whenever i click the title link in any of the rows , then the Selected link row should be the selected row(ie the currentTableNodeElement).

for eg :

In the webservices Navigator,

For the Particular services we are able to see the particular operations .

Thanks and Regards

Fazal

Edited by: Fazal Ahamed on May 21, 2008 11:25 AM

Former Member
0 Kudos

Hi,

If you access as follows it will always give the lead selected one

String key = wdThis.wdGetCompController().wdGetContext().currentTableNodeElement().getKey();

for this only i suggested you to use the sourceMapping for the Linkto action

If this is done as mentioned in my first post your action method will have a parameter

instead of accessing the key in the above manner you can access this from the element . So that even if your leadselection is some where else you will still get the clicked linktoactions Key.

Pl have a look at my first and prior one post for this.

Regards

Ayyapparaj

former_member201361
Active Contributor
0 Kudos

Hi,

Thanks a Lot Ayyaparaj.

Ue suggestion worked for my requirement.

Thank Shabir for ur valuable suggestions.

Thanks and Regards

Fazal

Answers (2)

Answers (2)

Former Member
0 Kudos

Hey fazal,

This is in addition to the above reply i gave. If the compatabiliy mode is NW04Plus, then it is easier to do what Ayyapparaj said. this is easier way to get the data in on Action method. Else, if it is not mandatory to keep Compatability mode in NW04Plus, change it to Auto, your code must work. else get the lead selection do process as you wish.

Also, if you are using his code sample, put the mapping code under if firsttime condition like,

if(firstTime){

....<mapping element code>

}

of wdModifyView Method

Hope it helps.

Former Member
0 Kudos

Hello Fazal,

if it is a normal table, table and the link to action ui element is presenet in normal column, by merily selecting on link, the row shoul be selected. it is surprising that is is not working that way. Please check for the following

1. Check whether the selection mode of table is Auto

2. The cardinality is 0..n or 1..n

3. The Link to action is not in master column.

4. You are clicking on the link and not on the space after the link.

5. Most important of All, the Compatability Mode property of table, check whether it is auto or NW04PLUS. it should be Auto for the below mentioned code or your code to work.

When ever a link to action is clicked, on action method is called. Here write some logic like

int lead = wdContext.nodeTableText().getLeadSelection();

String key = wdContext.nodeTableText().getTableTextElementAt(lead).getValue();

wdComponentAPI.getMessageManager().reportWarning(key);

TableText is the node Name.

If the link is clicked, then in this method, you can get the value and call the webservice based on this..

Just see, whether the selected value is printed in onaction method. if yes, the way the webservice is called can have some issue.