on 09-22-2009 1:23 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.