I receive old data when I use javascript with zTree

I receive old data when I use javascript with zTree

  
Someone can help me ? I tried a lot of things and nothing works. So I did a simple sample to explain my problem. See how to use the sample to understand it.  Insert 301 on "key to search" and click on "search & select" button. It will not work, but when you click on "select" link it will work fine.   I tried to use function to get a sync and receive the updated data and again it didn´t work (button Search function & select).    Another thing, you need to download the zTree to use this sample. ?There are only basic concepts here.
That's because the Button is set to Ajax Submit, while the Link is only Submit. For some reason, the SelectNode Action don't work with Ajax. Try to contact the zTree team to solve this.


Best regards,
André Siébra
Hi Andre,
   I changed the "Select" link to Ajax and the same happens. If you debug the program you will see that the search reference is only updated after the screen is refreshed. In other words, I only can access the real value when Outsystems platforms update the internal pointers.  Is not there a way to access the inputform data on source ?  Maybe it is the same problem that appears when you try to access a data form using a dynamic datasource: we have to update the current register on form.
  Any tips ?
Yeah.. now I see. Actually the problem is the getNodeByParam action. This action and SelectNode Action can't be used at the same request, because the result is being written in the input that will get the node attribute list (defined by the InputId parameter) on response. So you'll have to do two requests to achieve this, one to write the node result, and another to select the node using this result.

I've attached the solution, take a look.

Hope it helps!
Amazing!!!
It is working now.  Thanks so much!!
Andre,
   I realized I can reuse action using this way you shown. Is there some "action" inside Outsystem that I can reuse some actions inside the screen ? I would like to use some actions inside the webscreen as functions on logic. 
Luciano,

I don't know if I got what you want, but you can't reuse screen actions or even call screen actions in another one. Only user actions do this.

But you can try this awesome component: http://www.outsystems.com/forge/component/597/event-system/. It gives you great flexibility to refactor your screen logic and build reusable components. 

I´m glad that I can help :)

Best regards,
André Siébra
I will research it.

Thanks