Tapestry area updates regularly

What is the best way to update the Tapestry zone on a regular basis to pull data set changes from the server?

+5
source share
2 answers

You can use Prototype PeriodicalExecuter , and for this you need to call Tapestry ZoneManager to update the zone:

new PeriodicalExecuter(function(pe) {
    var zoneObject = Tapestry.findZoneManager(element);
    zoneObject.updateFromUrl(updateUrl);
}, 5);
+4
source

First, you will need to open the URL for the event handler:

public String getModeChangedUrl()
{
    // will call the onModeChanged method
    return resources.createEventLink("ModeChanged").toAbsoluteURI();
}

Then in the javascript block in your tml, assign the url to the variable:

var modeChangedUrl = "${modeChangedUrl}";

Then you need to get a handle to the ZoneManager javascript object:

var zm = Tapestry.findZoneManagerForZone(zoneId);

, ZoneManager, ajax. MultiZoneUpdate , .

MultiZoneUpdate, . , . , .

, URL-, "/", .. "http://www.host.com/app/page/event/param1/param2"

, url ZoneManager, -:

zm.updateFromURL(url);

henning, PeriodicalExecuter , , :

new PeriodicalExecuter(function(pe)
    {
        var zm = Tapestry.findZoneManagerForZone("anyZoneId");
        zm.updateFromUrl(url);
    }, 5);
+3

All Articles