cancel
Showing results for 
Search instead for 
Did you mean: 

Current element when using recursion node for TreeByNestingTableColumn

Former Member
0 Kudos

Hi,

I have a table with a TreeByNestingTableColumn row arrangement. To implement it, I have a node in the context (let's call it MyNode) with an inner recursion node. For my needs, the table has only 2 levels (1 sub-level).

Near the table, I want to have some fields (TextView, DropDownByIndex) that show data about the selected row in the table. These fields are bound to attributes in the MyNode node.

My problem is that when making a selection of a row in the table which is in the second level of hierarchy, the current element (wdContext.currentMyNodeElement()) is the top-level element, not the selected one.

I know I can get the selected row/element by using the getTreeSelection() method, but I want the fields near the table to update automatically upon selection in the table.

Any idea for a solution?

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi. Sorry, I am not in my office and dont have coding at hand. But I resolved a similar problem once by implmenting my own "onRowSelect" actionHandler and mapping the parameter element (or was it index?) to that method in the doModify method.

Then the table element selected was passed directly to my implmentation.

Answers (1)

Answers (1)

siarhei_pisarenka3
Active Contributor
0 Kudos

Hi Hagay

>Near the table, I want to have some fields (TextView, DropDownByIndex) that show data about the selected row in the table. These fields are bound to attributes in the MyNode node.

It's not possible to implement the fields as you want with binding to the MyNode node. If you bind them to MyNode explicitly they'll show exactly the current element of the top level, because WebDynpro does not take into consideration the recursion.

I propose the following solution for the situation:

1. Create a new node in the root of the context with attributes necessary for the fields near the table (let say CurrentTableRow (0..1]).

2. Bind the fields near the table to the attributes of the node.

3. In the supply function of the CurrentTableRow write the code like the following:

IWDNodeElement currentRowEl = wdContext.nodeMyNode().getTreeSelection();
if (currentRowEl != null) {
    IWDNodeElement currentRowCopyEl = node.createCurrentTableRowElement();
    WDCopyService.copyCorresponding(currentRowEl, currentRowCopyEl);
    node.bind(currentRowCopyEl);
}

4. In onLeadSelect event handler of the table invalidate the CurrentTableRow node:

wdContext.nodeCurrentTableRow().invalidate();

BR, Siarhei

Former Member
0 Kudos

Hi again. I'm back to the same issue...

>

> Hi. Sorry, I am not in my office and dont have coding at hand. But I resolved a similar problem once by implmenting my own "onRowSelect" actionHandler and mapping the parameter element (or was it index?) to that method in the doModify method.

>

> Then the table element selected was passed directly to my implmentation.

Thanks, but I'm not sure I got you here... Could you please explain what were you doing in the wdDoModifyView method?

>

> It's not possible to implement the fields as you want with binding to the MyNode node. If you bind them to MyNode explicitly they'll show exactly the current element of the top level, because WebDynpro does not take into consideration the recursion.

> I propose the following solution for the situation:

Is there a nicer way to do it, without creating a node especially for those attributes? I want to use the same context node and to be able to update it in the other way round as well (edit attributes in the fields near the table).

By the way - I no longer use a table with TreeByNesting, but rather a Tree.

Thanks!