Hi,

To render block as html markup, I did like this:

public String renderMarkup(RenderCommand renderCommand) {
        MarkupWriter markupWriter = new MarkupWriterImpl();

        // validation track
        ValidationDecorator decorator = new
DefaultValidationDecorator(environment,
assetSource.getExpandedAsset("${tapestry.spacer-image}"), markupWriter);
        environment.push(ValidationDecorator.class, decorator);
        RenderQueueImpl renderQueue = new RenderQueueImpl(logger);
        renderQueue.push(renderCommand);
        renderQueue.run(markupWriter);

        environment.pop(ValidationDecorator.class);
        return markupWriter.toString().replaceAll("^\\n+",
"").replaceAll("\\n+$", "");
    }

and call renderMarkup((RenderCommand )block).

Not sure whether it is better than yours, hope it helps.

2012/2/16 Christian Riedel <cr.ml...@googlemail.com>

> Hi there,
>
> I'm trying to improve the tapestry5-jquery DataTable component, which is
> able to respond paged results in JSON. Unfortunately the component is a bit
> limited in terms of what can be returned. I want to add support for the
> Grid-style p:propertyCell block-parameter-notation.
> I'm looking for the most elegant way to do it. Currently I'm trying it
> with faked zone updates (ajaxResponseRenderer.addRender) and a filter
> (ajaxResponseRenderer.addFilter) that should modify the JSON reply object.
> It feels very clumsy and I thought if someone on the list could point me to
> a more elegant solution.
>
> More Abstract:
> We've got
> - an Ajax callback: void onData() { ... }
> - PropertyOverrides, having block parameters
> - a working data source that is able to fetch data by the current page
>
> We need
> - loop over all rows of the current page and
> - render each cell's content or its override into a row-json-array and
> - put each row-json-array into a data json-array
>
> Is there another way than using ajaxResponseRenderer.addRender / addFilter?
>
> Cheers
> Christian
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to