How to use the Organisation Unit Web Tree
To make the Organisation Unit Web Tree visible on screen, add this to the page controlling actions:
<param name="javascripts">../dhis-web-commons/ouwt/ouwt.js</param>
<interceptor-ref name="organisationUnitTreeStack"/>
The organisationUnitTreeStack extends the transactionStack (because it has to) so no interceptor is left out. Also, add
to your menu template.
To be notified when an organisation unit has been selected, you must create a JavaScript function that you register as a listener. Here's an example:
<script type="text/javascript">
function orgUnitHasBeenSelected( orgUnitIds )
{
window.alert( "OrgUnits with ids " + orgUnitIds.join(", ") + " are selected" );
}
selection.setListenerFunction( orgUnitHasBeenSelected );
</script>
The selection variable is a pointer to an already created and instantiated Selection object.
To get hold of the selected organisation units in your action classes, use the bean implementing the org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager interface. Something like this:
<bean id="..." class="..">
<property name="selectionManager">
<ref bean="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager"/>
</property>
<bean>
With this bean you can also define the root of the web tree etc.
 |
Note that only action classes should use this bean since the bean is a pure user interface bean (the layers below shouldn't know about the user interface). Also, be sure to read the JavaDoc in the interface so that you know how the bean works. |