I'm working on a rather complex component involving An AjaxFormLoop where I need to detach and then reattach events to the DOM after the new HTML node has been inserted (as we're adding another input field to the form). When I'm using a regular zone, Tapestry provides by the way of Pub/Sub through various custom events like:
Tapestry.ZONE_UPDATED_EVENT Tapestry.TRIGGER_ZONE_UPDATE_EVENT >From what I can see and have read in the API docs, as well as having reverse engineered the Tapestry5-jQuery implementation we're using, it seems like there is a widget extension that manages this and has it's own AJAX to handle the communication (looks like the URL is passed through the options). >From tapestry-jquery.js: /** * Form Injector */ $.widget( "ui.tapestryFormInjector", { options: { show: "highlight" }, _create: function() { this.element .addClass( "tapestry-forminjector" ) }, destroy: function() { this.element .removeClass( "tapestry-forminjector"); $.Widget.prototype.destroy.apply( this, arguments ); }, trigger: function() { var that = this, el = $("#" + this.options.element); var successHandler = function(data) { $(data).log("data"); $.tapestry.utils.loadScriptsInReply(data, function() { // Clone the FormInjector element (usually a div) // to create the new element, that gets inserted // before or after the FormInjector's element. var newElement = el.clone(false); newElement.attr("id", data.elementId); newElement.html(data.content); newElement = that.options.below ? el.after(newElement) : el.before(newElement); newElement.effect(that.options.show); }); }; $(this.options).log("this.options.url" + this.options.url) $.ajax({ type:"POST", url: this.options.url, success: successHandler }); } }); Looks like no pub sub here. Is there any way to trigger a method that I can define on the init stack (Tapestry.Initializers)? I've tried rendering JSON as a return on the onAddRowFrom java event and that was placed as value to the input I was returning. I tried injecting JavascriptSupport in the same function and the server errored. Has anyone encountered this...or does anyone know of a way to trigger the init stack through an AjaxFormLoop so I don't have to re-write the base widget to add our own custom events? -- View this message in context: http://tapestry.1045711.n5.nabble.com/AjaxFormLoop-Updated-Event-tp5510722p5510722.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org