on 03-31-2009 7:44 AM
Hi
My table's first column are buttons.
All buttons in this column are bound to one action.
When the buttons were clicked,I need know which row they belongs to.
Anyone can help me? I'm working with NW7.0
Edited by: steiner fisher on Mar 31, 2009 8:49 AM
Hi,
1.Create a parameter of type IWDNodeElement for your action assigned to your button in the table.
2.Now in your wdDoModifyView write the code given below for Action Parameter Mapping.
IWDButton Button = (IWDButton)
view.getElement("ButtonID");
Button.mappingOfOnAction().addSourceMapping("<nodename>","nodeElement");
Here <node name> is the node which you have bind to the table and "nodeElement" is the parameter name. By writing this code we are dynamically mapping the current node element to the parameter "nodeElement".
3.Now Navigate to the view and select the button from the layout, right click and select parameter mapping.
Now map the nodeElement under the onAction of the button to the newly created parameter for your action.
4.Now in the action of the button write the code to set the lead selection.
public void
onActionActn_searchEmployee(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, com.sap.wdp.IPrivateContactsView.IVn_salescontacttableElement tableNode )
{
//@@begin onAction <Action name>(ServerEvent)
wdContext.<nodename>.setLeadSelection(tableNode.index());
}
This will help to set your lead selection to the row where your button is pressed. So now
wdContext.<nodename>.getLeadSelection(); will give yoy the index of the row.
Hope this will solve your issue. Please Get back if it is not clear.
Jithin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The context menu entry should be named "Parameter Mapping". If it is not available in your IDE version, you have to write two lines of code inside wdDoModifyView():
wdDoModifyView(...)
{
if (firstTime)
{
IWDButton button = (IWDButton) view.getElement("id_of_button_used_as_table_cell_editor");
button.mappingOfOnAction().addSourceMapping
(
"nodeElement", /* or better IWDButton.IWDOnAction.NODE_ELEMENT if available in your version)
"row" /* or whatever the action parameter is named */
);
}
}
Armin
Add a parameter "row" of type IWDNodeElement (or I<TableDataSourceNode>Element) to your action and action handler.
Use the parameter mapping editor ( Outline view -> Right-Click on button used as table cell editor -> Parameter Mapping).
Drag the action parameter "row" to the predefined event parameter "nodeElement".
In your action handler onAction(..., IWDNodeElement row), the parameter "row" contains the node element to which the button belongs.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
public void onActionSubmit(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, com.incture.abccomp.wdp.IPrivateTestView.ITestNodeElement element )
{
//@@begin onActionSubmit(ServerEvent)
wdContext.nodeTestNode().setLeadSelection(element.index());
//@@end
}
Here IPrivateTestView.ITestNodeElement element is the parameter of the action (which is bound to table where your button is , Do the parameter mapping right click on button and select parameter mapping )
Best Regards
Satish Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi fisher,
When you click button of particular Row.it will automaticaly identified through your lead selection.
int i=wdContext.node<yourtable node name>().getLeadSelection();
if you want to show the record which you had clicked for particular button.
you can use
public void onActionShow(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
int i=wdContext.node<your table node name>().getLeadSelection();
wdComponentAPI.getMessageManager().reportSuccess(" particual conlmn"+wdContext.node<your table node name>().get<node name>elememtAt(lead).get<Attribute name>());
;;;;;;;;;;;;;;;;
;;''
Thanks
jati
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Create on action with one parameter of type IWDElement of that node which is bound to table .now with this parameter u can do the lead selection or any thing which will specific to selected row.
Best Regards
Satish Kumar
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 | |
9 | |
7 | |
6 | |
5 | |
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.