I think there are some important things missing from Tapestry.js to release the full potential of Tapetsry 5 and AJAX. I have started working on a javascript class, TapestryExt, that extends the functionality of Tapestry.js.
My wish is to see all of this and more built in to tapestry.
/**
* Commonly needed functions that are absent in the default Tapestry js lib.*/var TapestryExt = {/**
* If the specified form listens for the Tapestry.FORM_PROCESS_SUBMIT_EVENT event* (all forms with a zone specified do), it will AJAX-submit and update its zone after.*/submitZoneForm : function(element) {element = $(element)if (!element) {Tapestry.error('Could not find form to trigger AJAX submit on');return;}element.fire(Tapestry.FORM_PROCESS_SUBMIT_EVENT);},/**
* Trigger any link, zone or not.** If no url is provided, the href attribute of element will be used.*/triggerLink : function(element, url) {element = $(element);if (!url) {url = element.href;}if (!url) {Tapestry.error('Unable to find url to trigger on element ' + element.id);}var zoneObject = Tapestry.findZoneManager(element);if (zoneObject) {zoneObject.updateFromURL(url);}else {// Regular link// Note: this will skip all event observers on this link!window.location.href = url;}}}
hi! Thanks for your share!it's really help me!
ReplyDeleteI got learn more tapestry native javascript!
in the js code:
submitZoneForm is a listen function.
and triggerLink look like a link's callback function.
hwo to use them together?
please give me a exmaple!
thank again!
Great additions! Have you filed a JIRA issue on this?
ReplyDelete