This content has been marked as final.
Show 1 reply
-
1. Re: Inline script elements in template files
aanderson1776 Jun 24, 2014 3:35 AM (in response to aanderson1776)After further research and experimentation I came across the GWT SrciptInjector that suites my needs. I can create a .js file in the classpath with any arbitrary JavaScript, create a ClientBundle
public interface JsResources extends ClientBundle { final JsResources INSTANCE = GWT.create(JsResources.class); @Source("com/someorg/someJS.js") TextResource someJS(); }
and then invoke the JavaScript in the GWT onload method inducing JavaScript execution which is almost identical to an inline script:
@Templated public class SomeTemplate extends Composite { @DataField("tenants-g @Override protected void onLoad() { ScriptInjector.fromString(JsResources.INSTANCE.someJS().getText()).inject(); } }