Hey,

By returning "this" in the onSuccess event, a redirect happens resulting in a new request. If you want to preserve data between requests, you will have to save it into the http session. If you add http session persistence, the data will be available after a new request. <http://tapestry.apache.org/persistent-page-data.html>

Simple example for your case:

@Persist
@Property
private Set<Street> streets;||


Be careful: in this case the whole streets set is saved into the http session and will remain there until the end of the session (or until you remove it manually). You could also persist the form vaues instead and then in setupRender event fill the trees set based on these values. Also you can make use of PersistenceConstants.FLASH to let Tapestry remove it from the session after first access automatically.
See more info: http://tapestry.apache.org/persistent-page-data.html||

Another option is making use of AJAX where the updated grid html is sent back in the response and updated on the client side. If you want to achieve this you'll need to add a Zone around the grid and make your Form submit with AJAX.

Your case:

<t:form t:zone="zoneGrid">
    ...
    <t:zone t:id="zoneGrid" id="zoneGrid"
        <t:grid source="streets" row="street">
        </t:grid>
    </t:zone>
<t:form>

@Inject
private AjaxResponseRenderer ajax;
@InjectComponent
private Zone zoneGrid;

void onSuccess() {
    ...
    ajax.addRender(zoneGrid);
}

See more info: http://tapestry.apache.org/ajax-and-zones.html


Hope this helps u a bit.
Nathan

On 25/04/16 11:05, Morgan Hautman wrote:
Hi,

I'm trying to make a make grid update when submitting a form within the
same page.

Here is the code:
https://gist.github.com/mhautman/e178fdcca46331e1f4932b1cd7074de7

The page gets refreshed but the table/source doesn't seem to be updated.

Any help is greatly appreciated.

Regards,
Morgan


Reply via email to