Hi gang,

I'm trying out a basic Ajax example.

I have an abstract BasePage with a layout.htm reusable template, with
HTML boilerplate, $cssImports, $jsImports, #parse($path) to include
the concrete page's content.

I have a HomePage that extends BasePage and a home.htm template that
just includes the content for the page, e.g. $table.

So far so good.

Now, say I want to load the HomePage with an Ajax request. I issue the
request and in BasePage#getTemplate(), I return getPath() instead of
layout.htm if it is an Ajax request.

This works beautifully! Except....that because the initial page
doesn't have a Table in it, the $*Imports don't include the CSS that
Table needs. When the Ajax request is issued, the response is only the
home.htm block, not the whole page, so the Table doesn't get to
contribute its imports to the page.

I can add an #if in home.htm to add $*Imports for an Ajax request, but
this is a hack and also repeats any imports that are common to the
initial page and to the home page.

Is there a cleaner solution to this problem?

PS context.isAjaxRequest() => nice touch :)

Thanks in advance for your help!

Freddy

Reply via email to