cancel
Showing results for 
Search instead for 
Did you mean: 

getLeadSelection when using a recursive MasterColumn

Former Member
0 Kudos

Hi,

I have a table, which its MasterColumn is bind to Folder node (in the context). The Folder node has a recursion node called SubFolder. In the table's OnLeadSelection action I need to retrieve the selected Folder. The problem is that I can only retrieve the selected element of a specific node, and since this is a recursive node, I do not know which is the selected node. Therefore, if I try wdContext.nodeFolder().getLeadSelection(), I always get the same number, even though the selected row in the table is changed.

How do I retrieve the selected element?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Carmit,

I had the same problem when using recursive Tree nodes. When we select any child node in the recursed structure, all the corresponding parents had a the lead selection set, so it was difficult to find out which node has been selected.

I was able to overcome this problem, by adding parameter mapping in the wdDomodifyView by passing the selected element to the Action dynamically, and in the actual action use this element, instead of using the lead select. It worked fine for me.

Does this help.

Cheers,

Balaji

Former Member
0 Kudos

Hi Balaji,

Thank you for your answer.

Could you pleas tell me to which action you mapped the selected element in wdDoModifyView()? I tried to map the selected element to the OnLoadChildren action of the MasterColumn, but I had a few problems:

1. the onLoadChildren action is called only when the user OPENS the tree node. When he CLOSES the tree node, this action is not called, and therefor I have no way to update the selected element.

2. I have no way to retrieve the selected element when the user just selects a row in the table in case of recursive tree nodes.

Former Member
0 Kudos

Hi Carmit,

The Tree has a onSelect Action to which i pass the selected element, but that is not applicable for the Master column.

Why done you uwse the onLeadSelect Action of the Table, and pass the selected element as a parameter mapping to the Action, so you can fire the Action when the user clicks on the Table Row, but you are not using the lead selection of the context, but what you pass as parameter directly.

Does this help.

Former Member
0 Kudos

Hi Balaji,

I know how it can be done with trees. The problem with tables is that I didn't find a way to connect the selected row number with the context element. The only mapping parameters I can use in the OnLeanSelect action are "row" and "col". Unlike trees, where you can map "path" (the selected element).

The only way I can think of is to recursively go over the context elements. If the element is expanded, go to his child, if it's not, go to his sibling. And do so until I visit a number of nodes equals to the selected row number.

Do you know of an easier way?

Former Member
0 Kudos

Carmit,

In action handler for onLeadSelect you can get access to the actual selected element of recursive node via

final IPrivate<ViewName>.I<RecursiveNodeName>Element selection 
  = wdContext.current<RecursiveNodeName>Element()

Believe me, this will be the <b>actual</b> element user clicked on table

Then, for example, you can ordinary traverse to parents via selection.current<RecursionNode>Element() until you reach the root.

Regards,

VS

Former Member
0 Kudos

Hi Valery,

My context contains Folder node and Folder contains a recursion node SubFolder. when you wrote <RecursiveNodeName> did you mean Folder or SubFolder. I'm asking 'cause I can only access wdContext.currentFolderElement(), and this always brings me to the first Folder element in the context, no matter what I clicked on in the table.

Any suggestions?

Maybe we're working with different WebDynpro versions?

Former Member
0 Kudos

Oops, I give you abit misleading comments.

The actual code for onLeadSelect should looks like this


final StringBuffer path = new StringBuffer(".");
for 
(
  /* Top-level folder at selection path*/
  IPrivate<ViewName>View.IFoldersElement current = wdContext.currentFoldersElement();
  /* We will break right after lead selection */
  null != current;
  /* Drill down one folder deeper by selection path */
  current = current.currentSubFolderElement()
)
{
  path.append('/').append(current.getName());
}
	
wdComponentAPI.getMessageManager().reportSuccess
(
  "Path at lead selection is: " + path
);

Hope this helps,

VS

Former Member
0 Kudos

Hi Valery,

Thank you very very much. It works!

I was struggling with this issue for at least a week, and couldn't find the answer.

Thanks again,

Carmit Pinto.

thomas_chadzelek
Participant
0 Kudos

Just to give you some hope for the future: in the next release, we will provide the node element selected by the used as an event parameter. Via parameter mapping, it will be very easy to access (just like it is for the tree).

Bye,

Thomas

Answers (0)