cancel
Showing results for 
Search instead for 
Did you mean: 

onAction method of Tree returns null tree element

Former Member
0 Kudos

Hi,

Would like to select an element in a tree. Used the onAction method. But it always returns a null element although the tree contains elements.

Do I need to add this source code addtionally?

if ( firstTime ) {

IWDTreeNodeType treeNode = (IWDTreeNodeType) view.getElement("TreeNodeType1");

treeNode.mappingOfOnAction().addSourceMapping("path","selectedElement");

}

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

MK,

Everything should work.

Just check the following:

1. You are adding source mapping to correct tree node (there are could be several)

2. Parameter in action handler has name <b>selectedElement</b> (check for misspelling) and has type of IWDNodeElement or any descendant thereof (like custom type of element in your view context)

Valery Silaev

EPAM Systems

http://www.NetWeaverTeam.com

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi MK,

If you are building your VIEW elements dynamically, then you do need the line of code in the wdDoModifyView section of the View Controller.

However if you have specified your view UI at design-time, there is no need for your line of code.

In the onAction method, are you correctly accessing the currently-selected node?

If you can post the relevant portion of your context here, and the onAction method code, it might be a bit easier to help resolve your problem

Regards,

Walter

Former Member
0 Kudos

Walter,

Currently (SP up to 13 incl.) you have to define action parameter mapping in source code (namely in wdDoModifyView) both for run-time & design-time created UI controls. There is no corresponding functionality in view designer.

Valery Silaev

EPAM Systems

http://www.NetWeaverTeam.com/

Former Member
0 Kudos

Hi MK,

Yes you need to add this line of code in your wdDoModify() method. And make sure you use the same name (i.e 'selectedElement') for the tree element parameter in your action handler method.

Hope this helps,

Best Regards,

Nibu.