Simple Module HTML elements id`s

LabKey Support Forum (Inactive)
Simple Module HTML elements id`s Ben Bimber  2014-10-31 08:12
Status: Closed
 
Hi Michal,

We typically do something like:

<script type="text/javascript">

Ext4.onReady(function(){
    //this is a substitution that will write an object with context about your page, including the ID of the DIV created for this webpart.
    var webpart = <%=webpartContext%>;

    //this element will be specific to this instance of the webpart, so it will be safe if there are multiple on the same page.
    Ext4.get(webpart.wrapperDivId).update('Hello World');
});

</script>

That is similar to the <%=contextPath%> and <%=containerPath%> substitutions you might be familiar with. If you have checked out a local copy of labkey from svn, you might look at the modules under \externalModules\labModules or \externalModules\DISCVR for some of our examples.