on 04-23-2007 10:11 AM
Hi everyone, i confused how to pass parameter in onAction for LinkToAction in A Table. I search in this forum and i find section "Parameter Mapping" but i'm still confused how this can solve my problem.
My Problem like this.
First I have a table, we can call this TablePerformance,there is a 6 column, and 2 of them have LinkToActionUIElement as TableCellEditor.
A | B | C | D |
x | Lta | Ltb | ... |
y | Lta | Ltb | .... |
Lta and Ltb is LinkToAction UI Element
This table has binded to context with the same name (TablePerformance)
- TablePerformance (value node)
|__CellA (value attribute)
|__CellB (value attribute)
|__CellC (value attribute)
|__CellD
- ...
- Languange (value attribute)
I need to open popup window that will display a list based on column A from tablePerformance, Languange and Type (Constant Value) --> if Lta is clicked Type = "XXX" else if Ltb is clicked Type = "YYY"
so I did this :
public static void wdDoModifyView(IPrivateCompetencyView wdThis, IPrivateCompetencyView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
{
//@@begin wdDoModifyView
if (firstTime)
{
IWDLinkToAction theLink = (IWDLinkToAction)view.getElement("Lta");
theLink.mappingOfOnAction().addSourceMapping("TablePerformance.CellA","objectID");
theLink.mappingOfOnAction().addSourceMapping("Languange","lang");
}
void OnActionLtaClicked(... objectId, ... lang)
{
}
Is this correct ? Because i am not sure with
"theLink.mappingOfOnAction().addSourceMapping("TablePerformance.CellA","objectID");"
will get column A correctly (get value x or y)
No, that's not correct.
To get the table row / node element for the cell editor with ID "Lta" (here a LinkToAction), just do
if (firstTime)
{
IWDLinkToAction editor = (IWDLinkToAction) view.getElement("Lta");
editor.mappingOfOnAction().addSourceMapping("nodeElement", "row");
}
Now, add parameter "row", type = ITablePerformanceElement, to your action.
void onAction<ActionName>(..., ITablePerformanceElement row)
{
row.getCellA(); /* this is value of attribute CellA in row where link was clicked */
}
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Satria,
Since here you have to pass the parameter values to the action try setString() function instead of addSourceMapping(). Also debug and see whether you are getting the correct values in the action.
Code sample
==========
IWDLinkToAction theLink = (IWDLinkToAction)view.getElement("Lta");
theLink.mappingOfOnAction().setString("TablePerformance.CellA","objectID");
theLink.mappingOfOnAction().setString("Languange","lang");
Regards,
Sudeep
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sudeep,
Thank you for your answer but i can't find method setString from mappingOfAnAction.I have running with my way and i get error when i run this application.
com.sap.tc.webdynpro.services.exceptions.WDIllegalArgumentException:
Parameter Languange not found
Please, is someone can help me ?
Regards,
Satria
Hi Satria,
You are right. setString() is available only in advanced version that outside customers don't have access to.
The error what you are referring to will come if you haven't added the parameters properly in your action and corresponding function. Kindly check whether you have added the parameter 'Language' in your Action and corresponding function. If not, do it and run the application again.
Regards,
Sudeep
Hi Sudeep,
You said i must add parameter 'Languange' in my Action but I define it in my context. In my action I define parameter lang. Is it correct?
Root Context
|_Languange
void OnActionLtaClick(... event,String lang)
{
}
wdModifView(...)
{
......
theLink.mappingOfOnAction().addSourceMapping(Languange,lang);
}
Hi Satria,
You are right. lang should be the parameter name. See the javadoc for the function below
void com.sap.tc.webdynpro.services.event.api.IWDParameterMapping.addSourceMapping(String sourceName, String newName)
Adds a new parameter to the parameter mapping. The parameter is read from the mapping source and stored in this instance.
Parameters:
sourceName name of the parameter in the mapping source object
newName name of the parameter after mapping
Regards,
Sudeep
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.