Tree Widget - Node Click Event Handling?

Tree Widget - Node Click Event Handling?

I'm attempting to integrate a Tree Widget into an Organization Hierarchy application that displays managers, supervisors, subordinates, etc... My question (hopefully not a silly one) is how can I direct a node-click event to an Action passing the referenced record object along with it? I know I can execute JavaScript by assigning the following to the TreeRow.Label property of the list. Here is what I have so far...

"<a href=""#"" onclick=""OnClickNode(); return false;"">" + GetEmployeeByUserId.List.Current.User.Name + "</a>"

I really didn't want to make a 'link' out of the nodes, I was hoping for a better solution. If this is the only way, I would at least like to be able to display a Show page referencing the clicked node-link from the OnClickNode() JavaScript function.

Any advice would be helpful. I've only been exploring OutSystems for a couple of weeks, so I know I have a lot to learn.


Hi Daryl,

What is usually done is to fill a hiden input with the id of the element that was clicked on the tree and then submit the page through a hiden link. This will send that id back to the server so that the screen action can use it to do whatever is needed.

"<a href=""#"" onclick=""setTreeNodeClickedAndSubmit(" + GetEmployeeByUserId.List.Current.User.Id + "); return false;"">" + GetEmployeeByUserId.List.Current.User.Name + "</a>"
Where the javascript function would be something like:

function setTreeNodeClickedAndSubmit(nodeId) {
    $('#" + hiddenUserIdInput.Id + "').val(nodeId);
    $('#" + hiddenSubmitLink.Id + "').click();
I hope this helps.