cancel
Showing results for 
Search instead for 
Did you mean: 

How to get LinkToAction UI Element id From Coding

Former Member
0 Kudos

Hi Experts,

I have small probelm in my application.

I have one view, which contain 6 LinktoAction UI elements. For all links i created same action. In that action i need to identify from which this action is called. Is there any option to get the UI Element Id in action using any coding(Event object).

Please tell any solution to identify from which action this method is calling....

Thanks,

Sunil

Accepted Solutions (0)

Answers (7)

Answers (7)

Former Member
0 Kudos

oo

Former Member
0 Kudos

Hi All,

I too having the same issue.

I think the codings provided here will not help in this regard. In view.getElement("<>"); we have to give the id of the UI element, for which parameter mapping has to be done. But, please note that in this scenario there are six UI elements(LinkToAction). Each UI will have its own id. So, which UI's id will you give there?

Former Member
0 Kudos

The answer given by Satyajit is absolutely correct, please read it again.

Armin

Former Member
0 Kudos

Hi Sunil,

You can do that by using the following code, try this out for your scenario

wdDoModifyView()

{

IWDLinkToAction link=(IWDLinkToAction)view.getElement("<Link Name>");

IWDParameterMapping mapParam = link.mappingOfOnAction();

mapParam.addParameter("<Parameter Name",<Value>); <<Parameter Name: You need to create one paremeter for the action in the action tab and give that name here, Value: give any value for the link 1,2,3..>>

//Repeat for remaining

}

Action(wdEvent, <type> Parameter Name)

{

depending on the value in the parameter you can get to know that the link which you clicked

}

If you have any concerns in that let me know.

Thanks,

Sandeep Bonam.

Former Member
0 Kudos

Hi,

An easier way to do it would be to add a parameter to your event.

1. Edit your action and add a new parameter of type int and call it "fromLink". Check that your event handler is also updated with this new parameter.

2. Add this code to the "<i>wdDoModifyView()</i>":

if (firstTime){
IWDLinkToAction link1 = (IWDLinkToAction)view.getElement("<id of the LinkToAction UI element>");
link1.mappingOfOnAction().addParameter("fromLink",1);
//Do the same for all the other links. You can do this inside a loop and add the loop index as the parameter value.
}

3. In your event handler simply access this parameter to find out which link was clicked.

Regards,

Satyajit.

Former Member
0 Kudos

Hi Sunil,

Try out the following code:


   IWDTransparentContainer transparentUi = (IWDTransparentContainer)view.getElement("");
    IWDUIElement[] uiElements = transparentUi.getChildren();
    for(int i=0;i<uiElements.length;i++){
    	try{
    		IWDLinkToAction linkAction = (IWDLinkToAction)uiElements<i>;
    		linkAction.getId();
    	}
    	catch(ClassCastException c){
    		c.getStackTrace();
    	}
    }

This will give you the Id at runtime.But I am not sure if its possible to somehow get the Id since there's no event handler existing for it.

@Satish GS : maybe you can try with the sending the screen shots of the search results you find on SDn directly which'll be more clear also the links that you've sent dont make any sense in this respect.

Regards

Amit

Message was edited by:

Amit Kesari

Former Member
0 Kudos

Hi Sunil

I am also new to Web Dynpro but I understand your problem

Try My Suggestion i may be helpfull i think

Each and Every LinkToAction has corresponding Method better put this code inside the all the methods at the end.

wdComponentAPI.getMessageManager().reportSuccess("Specify the LinkToAction id");

So that at the time of execution of any one of six LinkToAction the follwing message will be displayed with the corresponding id

You can get id from the property window

Regards

Chandran

Former Member