var ZoneUpdater = function(spec) {
var elementId = spec.elementId;
var element = document.getElementById(elementId);
var url = spec.url;
var $zone = jQuery('#' + spec.zone);
var updateZone = function() {
var updatedUrl = url;
var params = {};
if (element.value) {
params.param = element.value;
}
$zone.tapestryZone('update', {
url : updatedUrl,
params : params
});
}
if (spec.event) {
var event = spec.event;
jQuery(element).bind(event, updateZone);
}
return {
updateZone : updateZone
};
}
Wednesday, March 16, 2011
ZoneUpdater - jQuery edition
I recently started using the excellent tapestry-jquery plugin that replaces prototype in T5. The internal implementation of zones in tapestry changes quite a bit in tapestry-jquery, so I had to change a couple of things in ZoneUpdater too. I find the updated code to be quite a bit better, here it is:
Subscribe to:
Post Comments (Atom)
Can you help me update new version of periodicupdatemixin (http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/periodicupdatemixin)
ReplyDeleteSorry, because I'm not knowing much about mixin and javascript...