on 05-02-2006 7:53 AM
Hi
I have a table with to drop downs in each line (DropDownByIndex).
When I select a new value in one of the drop downs, an event is sent with a parameter (index) telling which index of the drop down was selected, but the event doesn't tell which drop down sent the event...
How do I find out which drop down raised the event?
Regards
Jacob
Hi Jacob,
You need to add parameter to parameter mapping of onSelect event for <b>each</b> dropdown list. In wdDoModifyView put something like:
IWDDropDownByIndex ddbi = ...;
ddbi.mappingOfOnSelect().addParameter("id", ddbi.getId());
and in your action handler add parameter "id". This parameter will contain id of your dropdown.
Best regards, Maksim Rashchynski.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Maksim
Thanks for your input.
The problem with this solution is, that I can have several rows in the table, each having their own instances of DropDownByIndex1 and DropDownByIndex2.
This means that once the event is fired, I only know which column the drop down is in I don't know which row it's in.
I need to know which row and column the onSelect event was fired from.
Do you understand what I mean?
Regards,
Jacob
Map the (implicit) event parameter "nodeElement" to an action parameter of type IWDNodeElement. Cast this parameter if needed to your specific node element type.
wdDoModifyView():
if (firstTime)
{
IWDDropDownByIndex dd = (IWDDropDownByIndex) view.getElement("ID-of-drop-down-list");
dd.mappingOfOnSelect().addSourceMapping
(
"nodeElement", /* name of implicit event parameter */
"selectedElement" /* name of action parameter */
);
}
Note: This does not work in older releases.
Armin
I think since SP13, see also Bertram's nice article
Have you used the correct spelling "nodeElement" in the mapping statement?
Armin
Hi Armin,
I am getting the following error message when i'm trying to do the same.
Error
-
java.lang.ArrayIndexOutOfBoundsException
com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Failed to convert parameter nodeElement="nodeElement" into a node element
Code
-
doModifyView()
--------------
IWDAction cellEntry = wdThis.wdCreateAction(IPrivateChrtabView.WDActionEventHandler.CELL_VALUE_CHANGE,"");
IWDTable iTabFinal = (IWDTable)view.createElement(IWDTable.class,null);
iTabFinal.bindDataSource("NewElements");
iTabFinal.setToolBar(tb);
iTabFinal.setCompatibilityMode(WDTableCompatibilityMode.NW04_PLUS);
Iterator itrElement = wdThis.wdGetContext().nodeNewElements().getNodeInfo().iterateAttributes();
int index = 1;
while(itrElement.hasNext())
{
IWDAttributeInfo iWDInfoElements = (IWDAttributeInfo) itrElement.next();
IWDTableColumn iTabColFinal = (IWDTableColumn) view.createElement(IWDTableColumn.class,null);
IWDInputField idk = (IWDInputField)view.createElement(IWDInputField.class,"inp_"+index);
idk.bindValue("NewElements."+iWDInfoElements.getName());
idk.setOnEnter(cellEntry);
idk.mappingOfOnEnter().addParameter("colValue",String.valueOf(index));
idk.mappingOfOnEnter().addParameter("nodeElement","nodeElement");
iTabColFinal.setTableCellEditor(idk);
IWDCaption iCapFinal = (IWDCaption) view.createElement(IWDCaption.class,null);
iCapFinal.setText(iWDInfoElements.getName());
iTabColFinal.setHeader(iCapFinal);
iTabFinal.addGroupedColumn(iTabColFinal);
index++;
}
container.addChild(iTabFinal);
container.addChild(bt2);
onActionCellValueChange()
-
No action written. Just a success message is printed in this action. But the control is not even coming to this line of code. Before itself the program dumps with the above error message
Hope you can help.
Kind Regards,
Sudeep.
Hello Armin,
I found out the problem.
I have used function addParameter() instead of addSourceMapping() in my code.
Problem is resolved now.
Thanks..
Sudeep.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
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.