Examples can be found in JumpStart, starting here: http://jumpstart.doublenegative.com.au/jumpstart/examples/javascript/javascript
> On 26 Sep 2018, at 3:19 pm, Chris Poulsen <mailingl...@nesluop.dk> wrote: > > Reacting to the zone events sounds like the best option IMO. Controlling > this from the server side seems needlessly complex and fragile in this case. > > Not really related to your issue, but you can call exported module methods > in 5.4 like this: > > JSONObject specification = new JSONObject( "diagramClientId", > diagram.getClientId(), "modelJson", modelJson ); > > jsSupport.require( "pages/contentspace/content-space-index" ).invoke( > "init" ).with( specification ); > > HTH. > > -- > Chris > > On Wed, Sep 26, 2018 at 1:10 AM Christopher Dodunski < > chrisfromtapes...@christopher.net.nz> wrote: > >> After exploring a little further, I discovered the below thread on >> invoking javascript from within Tapestry. >> >> >> https://stackoverflow.com/questions/27988473/pass-parameter-from-java-to-js-in-tapestry >> >> Joost writes: >> >> You will need to use the JavaScriptSupport service. >> >> Your java file: >> >> @Import(library = "RoomManagement.js") >> public final class RoomManagement{ >> >> @Inject >> private JavaScriptSupport javascriptSupport; >> >> @Property >> private long contactId; >> >> @AfterRender >> private void setup() { >> JSONObject jsonObject = new JSONObject(); >> jsonObject.put("contactId", contactId); >> javascriptSupport.addInitializerCall("RoomManagement",jsonObject); >> } >> } >> >> Your RoomManagement.js >> >> Tapestry.Initializer.RoomManagement = function (parameters) { >> //do whatever you need here >> alert('Your contactId: ' + parameters.contactId); >> }; >> >> This looks promising, but I later read that Tapestry's handling of >> javascript has been completely rewritten in Tapestry 5.4, with the above >> being deprecated. And I've not found any example code of doing tnings the >> new way. Any pointers would be much appreciated. >> >> My page contains 10 expand/collapse buttons, and I only wish to animate >> the one connected to the zone being updated. So am thinking of giving >> each button a unique ID, and passing that ID to the javascript so just the >> one button animates. >> >> My needs are pretty straight forward, and reportedly Tapestry's javascript >> handling was completely rewritten in 5.4 to simplify things. Look forward >> to seeing how things now get done. :-) >> >> Appreciate any help. >> >> Regards, >> >> Chris. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org