
<%--  Fetch to prevent lazy initialization error.  --%>
<% assetInstance = Asset.read(assetInstance?.id)%>

<div class="static_tree">
    ${assetInstance?.encodeAsHTML()}
    <div class="static_tree_compact">
        <ul>
        <g:each var="assetSubItem1" in="${assetInstance?.assetSubItems?.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } }">
            <li>
                ${assetSubItem1?.encodeAsHTML()}
            </li>

            <div id="treelevel1">

                <ul>
                <g:each var="assetSubItem2" in="${assetSubItem1.subItems.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } }">
                    <li>
                        ${assetSubItem2?.encodeAsHTML()}
                    </li>
                </g:each> <!--assetSubItem2-->
                </ul>

            </div>

        </g:each> <!--assetSubItem1-->
        </ul>
    </div>
</div>
