cancel
Showing results for 
Search instead for 
Did you mean: 

Identifying selected UI Element ID onAction

Amey-Mogare
Contributor
0 Kudos

Hi all,

I am creating a multiple LinkToAction UI elements dynamically.

All these UI elements are bound to same action (ie event handler).

Now, the task is to remove the LinkToAction which is clicked.

In the event handler, how would I know which UI element to delete in wdDoModifyView method?

Any ideas/comments on how to achieve this functionality?

Thanks and regards,

Amey Mogare

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Add an action parameter "linkID" to the action that is executed for each link. Define an event parameter mapping like


link.mappingOfOnAction().setString /* use addParameter() in older versions*/ ("linkID", link.getId());

Then you know the link ID inside the action handler. To delete the link (which is somewhat strange but...) you could just store the ID inside a context attribute and in wdDoModifyView(), check the attribute value: if it is not NULL, delete the corresponding link and set the attribute value to NULL.

Armin

Amey-Mogare
Contributor
0 Kudos

Hi Armin,

Thank you for valuable reply.

Actually I want to implement scenario which is similar to Gmail's attachment feature.

Initially there is only a single link named Attach a file

Then on click of this link --> a FileUploadUI element appears along with Remove like right beside it.

When this Remove button is clicked, this particular linkToActioUI element and FileUploadUI element disappears!

Thanks and regards,

Amey Mogare

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Amey,

You can use concept of parameter mapping for the same.

using parameter mapping you can figure out the linktourl uielement's id at runtime.

It needs only few statament in wdDoModify() method where you need to provide linkup information.

if(firsttime){

linktoUrl(linktoUrl UIelement's).mappingOfOnAction().setString ("linkID", {linktoUrl UIelement's Object}.getId());

}

and in action handler method you need to add parameter with name "linkID' for linktoURL which refers to id of currently clicked linktoURL UI Element.

Best Regards,

Pankaj Sharma