Hi OS Community,
I am building a tree using graphing library. In each node of the tree I define the text, image etc using HTML. In each node I also want a link which triggers a client action (the action having one parameter passed into it). What is the best way to do this. For example i want to add something similar to my node <a href=MyAction(2211)> Click me </a> where MyAction is some kind of Client Action. Can be an onclick too.
If there was a way to reference a block (where the content of the block was a link and the block contained the client action) via HTML then that could work as well.
I look forward to your ideas,
Rob
You can create an OnReady event on your page. Add a Javascript block and define a function that you call with your onclick event. And in that function add the action you want to create pre-pended with "$action."
function MyClickFunction(){ $action.MyActionHere(); }
Kind regards,Eric
Hi Robert,
Did you explore the option to add an event to the link and then call the Client Action? Or your use case is different?
Cheers,
António Pereira
Hi Antonio,
Yes, this is a different situation. In an expression i am writing the html manually. I'm not using the Outsystems link widget. Something like this
Node Contents expression = "<div class='node-title'>Title</div><div class='node-content'>Description</div><a href=myActionHere()>Click me</a>"
Where myActionHere() is, that should be the name of the client action.
Thanks for your help though :)
did you find a solution?
Best regards
Dimitri
Thanks All, yes the way I solved this was to use a javascript action to trigger my client action.
ThanksRob