on 03-07-2011 8:48 AM
Hi, I have a problem. In my application I have a table, with the property "selecction Mode = none". In the first column I have a linktoAction where pressing this link, access a new screen that displays the information of the selected node. I tested with the mapping function for the row index of the node that I press, but have received nothing. This is the code used:
...
public static void wdDoModifyView (IPrivateBuscadorEmpleadosView wdThis, IPrivateBuscadorEmpleadosView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean FirstTime)
{
/ / @ @ Begin wdDoModifyView
if (FirstTime) {
....
table.mappingOfOnLeadSelect (). addSourceMapping ("row", "indexRow");
...
}
/ / @ End
}
public void onActionSelecEmpleado (com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, int indexRow)
{
/ / @ @ Begin onActionSelecEmpleado (ServerEvent)
wdContext.nodeEmpleadosOriginal (). moveTo (indexRow)
/ / @ @ End
}
...
How I can fix it? How I can get the index of the column that I have pressed? It is essential that the table has the property "selecction Mode = none", thanks in advance, and sorry for my poor English, greetings.
Hi,
You can achive this by means of Parameter mapping for the link to action UI you are using, below are the steps
1. For the onAction method of the Link to Action UI add an input parameter selectedElement of type IWDNodeElement.
2. Add the below mentioned code in the wdDoModify() method, assuming "la_Link" is the Id of the Link to Action UI added in the table cell
if(firstTime){
IWDLinkToAction link = (IWDLinkToAction) view.getElement("la_Link");
link .mappingOfOnAction().addSourceMapping("nodeElement","selectedElement");
}
3. In the onAction method of the Link to Action UI use the below line of code to get the selected row, using which you can get the corresponding values in that row as well as the row index
IPrivate<ViewName>.I<TableNodeElement> element = (IPrivate<ViewName>.I<TableNodeElement>) selectedElement;
int rowIndex = element.index();
Regards,
Vishweshwara P.K.M.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In "newer" releases you can/should define the parameter mapping inside the view designer instead of coding. Right-click the corresponding UI element in the "Outline" view and select the "Parameter Mapping" entry from the context menu. Drag the action parameter from the right side and drop it onto the "nodeElement" event parameter on the left.
Hi,
If the table UI property selection mode is set to none then the below mentioned code to fetch the current row value will not work.
wdcontext.currentEmpleadosElement().getAttributename();
So we must use the below code to fetch value
int current_Rowindex = wdcontext.currentEmpleadoselement().index();
String value = wdcontext.nodeEmpleados().getElementAt(current_Rowindex).getAttributeAstext("<AttributeName>");
We need to go for parameter mapping to fetch the current row element value only if the table UI property
Compatibility Mode - Nw04plus
By default the compatibility mode is auto.
If compatibility mode is set ot Nw04plus then as Vishweshwara said we need to go for parameter mapping to fetch the current
row value on click of link to action in table column.
Regards,
Bala Baskaran.S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, I used the code to my table with the property to none:
int current_RowIndex = wdContext.currentEmpleadosElement().index();
and I can not place it in the row of the table, always choose the first element, ie, element 0
Vishweshwara P.K.M , you were right, I solved the problem with your code, thanks!
Bala Baskaran, thank you very much too
Hi,
You have binded the node Empleados to the table UI element Datasource Property.
You have a linktoaction UI element in one column of the table.
If you have set the selection mode property of table ui to 'none' then the lead selection column will not appear in the
table ui element in output.
Create a event(onAction) for the linktoaction ui element.
In the action write the code to fetch the values:
int current_Rowindex = wdcontext.currentEmpleadoselement().index();
String value = wdcontext.nodeEmpleados().getElementAt(current_Rowindex).getAttribbuteAstext("<AttributeName>");
Read the row attributes one by one using the above code.
Regards,
Bala Baskaran.S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If you want to get the selected table row value on click of linktoaction UI
You can use the below code if table ui selection mode = none
int current_Rowindex = wdcontext.currentVnTableelement().index();
//PO_Desc is context attribute Name
String Description = wdcontext.nodeVnTable().getElementAt(current_Rowindex).getAttribbuteAstext("PO_Desc");
Regards,
Bala Baskaran.S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, but I did not understand very well. Do I need to do the mapping?
I haven't a Node "Table" in the context of my view, I have a node of the type of the elements of this table.If I use this method always selects the first node element...
Attached is a picture of the properties of my table
[http://piczasso.com/i/ozspg.JPG]
Hi,
Which version of NWDS are you using?
Regards,
Himanshu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
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.