Javascript in template

Hi,

I’m trying to dynamically load different views into a template view through the user clicks on buttons. I’ve defined the buttons and have tied them into functions triggered by click events. The functions look like:

function one(){
     $$("contentid").define("template","http->test.html");
     $$("contentid").render();
}

I am able to load the html file into the template and view it, but the javascript that was in the template does not get invoked. Is it possible to run the javascript from a template loaded file? I would like to do this so that I can create a file that can include your other views like so:

/* test.html */
<script>
dhx.ready(function(){
     dhx.ui({
           .......... view goes here such as form, accordian, etc.
     })
});
</script>

Can this be done or should I be doing it via another method?

Thanks!
Chris

While there is no way to evaluate js during html template loading, there is a way to load ui config dynamically.

Check , in latest package
samples\template\03_ajax_ui.html

In most cases, instead of ui reloading it may have sense to use “multiview” element and just switch visible view.

I would actually prefer to use the multiview, but I cannot find how to add and remove cells dynamically. I want to minimise the onload footprint and also want to make sure that as more cells are loaded, we do not crash the browser. Any chance you have a sample for dynamically creating and destroying cells in the multiview?

Thanks again!