I tried to implement a solution, inspiured by the source code of the Zone component. It works (almost). The problem is that the afterLoad block is empty for the dynamic request.

Can anybody see, at a first glance, what I am missing?

Next question would be: how can I force the update after loading? My suggestion would be something like
   renderSupport.addInit(" ??? ");


Thanks,
Andy




@SupportsInformalParameters
public class AfterLoadContent {

    @Mixin
    private DiscardBody discardBody;

    @Inject
    private Request request;

    @Environmental
    private RenderSupport renderSupport;

    @Environmental
    private ClientBehaviorSupport clientBehaviorSupport;

    @Inject
    private ComponentResources resources;

@Parameter(required=false, allowNull=false, defaultPrefix=BindingConstants.LITERAL)
    private String id;

@Parameter(required=true, allowNull=false, defaultPrefix=BindingConstants.BLOCK)
    private Block afterLoad;

@Parameter(required=true, allowNull=false, defaultPrefix=BindingConstants.BLOCK)
    private Block initial;


    public Object beginRender(MarkupWriter writer) {

        if(request.isXHR()) {
            return afterLoad;
        }

        if (!resources.isBound("id")) {
            id = renderSupport.allocateClientId(resources);
        }

        Element e = writer.element("div", "id", id);

        resources.renderInformalParameters(writer);

        e.addClassName("t-zone");


        clientBehaviorSupport.addZone(id, "show", "highlight");

        return initial;

    }



    public void afterRender(MarkupWriter writer) {
        if(!request.isXHR()) {
            writer.end();
        }
    }




from the template:


<div t:type="t5c/AfterLoadContent" t:id="someID">
   <t:parameter name="initial">Initial</t:parameter>
   <t:parameter name="afterLoad">AfterLoad</t:parameter>
</div>


<a href="#" t:type="ActionLink" t:zone="someID">Update Zone</a>










Andy Pahne schrieb:

Hi,

I need to build a page that dynamicly loads parts of itself after the initial render in the browser. Those parts are the result of longer running computation and can't be included when the page is rendered for the first time.


I remember that a third party component that achieves something very similar (dynamcly reloading parts, triggered automaticly) already exists. But I don't know where I read about it (mailing list, wiki, other sources) and cannot find it again.

Does anybody now what component I am talking about or has any pointers how I can achieve my goal?

Andy

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to