Freddy Daoud wrote:

I keep coming back to the very simple solution of just including the
necessary CSS and JS required by the control in question, e.g. the plain
Click Table, in the header of the initial page. Since that initial page is
not reloaded during AJAX interaction, and since $cssImports and $jsImports
do not appear in the template fragments returned by the Ajax calls, the
imports are included exactly once. The upside is that it's a very simple
solution; the downside is that you'd need to maintain the list of necessary
CSS and JS imports in your base layout according to all the controls that
could possibly appear as your user navigates throughout the pages of your
application.

Let me know if you have more thoughts on this.


It sounds as if you are loading all JS and CSS dependencies of the whole application up front in your BasePage?

If so, its probably easier to load the dependencies on a per Page basis by overriding Page#getHeadElements.

I agree though that having each Page knowing upfront its dependencies of all possible Ajax interactions would be quite simple, but as you stated, tedious to maintain in the long run.

kind regards

bob

Reply via email to