I tried importJavaScriptLibrary and it is really done dynamically. I did what you proposed:
@Inject @Path("context:js/jquery-ui-1.8.19.custom.min.js") protected Asset jqueryUi; @Inject @Path("context:js/TableTools.js") protected Asset tableTools; @Inject @Path("context:js/dataTables.editor.min.js") protected Asset dataTablesEditorMin; @Inject @Path("context:js/dataTables.editor.commons.js") protected Asset dataTablesEditorCommons; In Java code I'm then checking whether I have data for datatable or not. If I have the data, I'm importing the libraries: // import datatables and tabletools JS libraries javaScriptSupport.importJavaScriptLibrary(jqueryUi); javaScriptSupport.importJavaScriptLibrary(tableTools); javaScriptSupport.importJavaScriptLibrary(dataTablesEditorMin); javaScriptSupport.importJavaScriptLibrary(dataTablesEditorCommons); It works perfectly :), thank you :). Regards, Lidija On Wed, Oct 23, 2013 at 1:55 PM, Thiago H de Paula Figueiredo < thiag...@gmail.com> wrote: > On Wed, 23 Oct 2013 07:14:43 -0200, Steve <steves...@gmail.com> wrote: > > Hi Lidija, >> > > Hi, guys! > > > I had a similar question myself about conditionally including >> libraries and I believe you can find the answer here: >> http://tapestry.apache.org/**javascript.html<http://tapestry.apache.org/javascript.html> >> >> If you scroll down (or ctrl +f) to "The importJavaScriptLibrary >> method" - I think this may help you. It looks like the approach you >> are using is also documented under "Approach 1: @Import". >> > > @Import will always do the import. I you use > JavaScriptSupport.**importJavaScriptLibrary(), > you can do it dynamically. In addition, your problem may be solved by > adding a test in the JavaScript code to check whether the table is actually > there before applying the jQuery data table on it. > > > Hope this helps, i'm new to Tapestry myself so please take what I say >> with a pinch of salt, but the documentation seems to show how it can >> be done (I believe you would just need an if statement in your page >> class). >> > > That's correct. :) > > -- > Thiago H. de Paula Figueiredo > Tapestry, Java and Hibernate consultant and developer > http://machina.com.br > > > ------------------------------**------------------------------**--------- > To unsubscribe, e-mail: > users-unsubscribe@tapestry.**apache.org<users-unsubscr...@tapestry.apache.org> > For additional commands, e-mail: users-h...@tapestry.apache.org > >