Re: [5.4] update zone with javascript

2013-12-17 Thread Matthias
Hi Eugen, my javascript file is located in META-INF/modules/. It is loaded without problems when I call js.require("myModule.js");. Just the invoke call gives the problem. Anyway, I've missed that some form input values should be up to date when doing the zone update request. So I did a litt

Re: [5.4] update zone with javascript

2013-12-17 Thread Eugen
Hi Matthias, how do You define the myModule? It should be a javascript file in META-INF/modules/myModule.js to be automatically loaded as module. alternatively You can contribute the ModuleManager in Yout AppModule to laod desired JS file as module: @Contribute(ModuleManager.class) public s

Re: [5.4] update zone with javascript

2013-12-14 Thread Matthias
Hi Eugen, thanks a lot, I got the zone updates now :). There is only one problem with the initialisation at startup. When I use the invoke method require js prints an error: RequireJS error: require: moduleLib is undefined @AfterRender public void afterRender() { javaScriptSup

Re: [5.4] update zone with javascript

2013-12-12 Thread Eugen
Hi Matthias, as second parameter of deferredZoneUpdate() function You need to provide a event link to a function that returns a block or a Zone.Body, something like: @OnEvent("update-zone-event") Object myEvent() { return request.isXHR()?zone.getBody():null; } the event Link, t

Re: [5.4] update zone with javascript

2013-12-12 Thread Matthias
Thanks to both of you, I tried Howard's approach but I think I missing something fundamental. Heres my new code: JavaScript require([ "jquery", "t5/core/zone" ], function($, zoneManager) { // #1 with zone.update var myZone = $("#myZone"); // why do I have to set the data-update-zone

Re: [5.4] update zone with javascript

2013-12-12 Thread Howard Lewis Ship
The short form is: trigger an events.zone.update event on the zone's client-side element to update it immediately, using available content (a string, or DOM elements). Or, trigger events.zone.refresh event when you know a URL and additional parameters; Tapestry will run the Ajax request and updat

Re: [5.4] update zone with javascript

2013-12-11 Thread Geoff Callender
This should give you the clues you need: it's the ZoneUpdater mixin from the upcoming preview of JumpStart 7. It uses a dependency on "t5/core/zone". Example usage: ZoneUpdater.java: /** * A simple mixin for attaching javascript that updates a zone on any client-side event. * Based on htt

[5.4] update zone with javascript

2013-12-11 Thread Matthias
Hi, I'd like to update a zone with a simple ajax call and I'm not sure how its done: Javascript require([ "jquery", "myController"], function($, myController) { $(myController).on("myEvent", function(e) { // here i'd like to fire an ajax call that should update my zone }); });