Why do you return following in the event?

return new TextStreamResponse("application/json", response.toString());

Does it work if you return void?

On 30/10/13 15:25, lidijaldo . wrote:
Thank you for your response.

I changed the call to addRender:
ajaxResponseRenderer.addRender(boxZone);

I restarted the application.

I'm using Firebug but absolutely nothing happens that's connected to the
zone. There's an ajax request to edit the row and I can see the request -
the POST parameters and the JSON response that's returned to the browser.

But nothing concerning the zone. There must be something I'm missing.
There's no java exception and no _javascript_ error.

Is there any simple tapestry example for refreshing the zone from java?

Regards,
Lidija


On Wed, Oct 30, 2013 at 2:57 PM, Dmitry Gusev <dmitry.gu...@gmail.com>wrote:

Looks ok to me at first glance.

    ajaxResponseRenderer.addRender("boxZone", boxZone);
You don't have to specify clientId when you passing a zone here and this
zone has id attribute declared in template.

Try inspecting network activity in your browser's developer tools (firebug,
etc.) to see how zone update works, i.e. what's returned to client when you
call ajaxResponseRenderer.addRender(...);

There is a bug in tapestry when you have to restart the app if you changed
zone id in your template -- it won't be picked up without restart.


On Wed, Oct 30, 2013 at 5:49 PM, lidijaldo . <lidija....@gmail.com> wrote:

I thought this should be simple but I can't seem to find the solution.

I have a datatable displayed on my page. After I successfully edit some
row, I would like to refresh a zone on my page.

This is the relevant part of my .tml file, let's say I'm trying to
refresh
current time after I edited a row:

<table t:type="jquery/datatable" t:id="najdiEdiDataTable"
t:source="datasource"
                       t:row="moduleItem" t:rowIndex="index"
t:model="sourcemodel"
                       t:rowsPerPage="10" t:options="dataTableOptions" />

<t:zone t:id="boxZone" id="boxZone">
    ${getTime()}
</t:zone>



My java code:
At the end of the edit method, before I return response to re-draw
datatable with the modified objects, I'm also trying to refresh the above
zone:

@InjectComponent
@Property
private Zone boxZone;

@OnEvent(component = DATATABLE_ID, value = EVENT_EDITOR_EDIT)
    public Object edit(@RequestParameter("action") String action) throws
Exception {

        .... // edit and save object

        // refresh module box
        logger.debug("request.isXHR() = " + request.isXHR());      //
this
outputs "true"
    ajaxResponseRenderer.addRender("boxZone", boxZone);

        return new TextStreamResponse("application/json",
response.toString());
}

public String getTime() {
    return new java.util.Date().toString();
}


But it seems that ajaxResponseRenderer.addRender("boxZone", boxZone);
doesn't do anything. Am I missing something? Isn't it that simple?

Regards,
Lidija



--
Dmitry Gusev

AnjLab Team
http://anjlab.com


    


--

Een klare kijk op aanvullende pensioenen

Nathan Quirynen
03 340 04 60 | 0494 28 45 15
nat...@pensionarchitects.be

Follow us on Web | Twitter | LinkedIn | RSS | YouTube

Reply via email to