Get the url for a Seaside callback programmatically
Some times you need it from anywhere, not just a component.
This method here will return an object that will render the javascript function that will open a second tab in the browser navigating to the url and doing whatever the [ self onSelected ] block is doing:
onSelectedFunctionOn: html
| selectedCallback actionUrl param fullUrl |
selectedCallback := WAActionCallback on:[ self onSelected ].
actionUrl := html actionUrl copy.
param := html callbacks store: selectedCallback.
actionUrl addField: param.
fullUrl := self session applicationUrl, actionUrl asString.
^ JSFunction new argument: 'anEvent';
add: ('anEvent' asJSObject notNull then: 'anEvent.stop()' asJSObject);
add: ('window.open("',fullUrl,'","_blank", "");return false') asJSObject;
yourself
Written by sebastian sastre
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Smalltalk
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#