Liferay 6.2 Alloy UI Dropdown

3k views Asked by At

Im trying to make this example work on my Liferay 6.2 installation: http://alloyui.com/tutorials/dropdown/

But for some reason is not working for me, i have added the code on my view.jsp file inside my portlet, this is the code:

<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
`<%@ taglib uri="http://liferay.com/tld/aui" prefix="aui" %>
<nav class="navbar navbar-default">
<div class="container-fluid">
    <div class="navbar-collapse">
      <ul class="nav navbar-nav">
        <li id="myDropdown" class="dropdown">
          <a id="myTrigger" href="#" class="dropdown-toggle">Dropdown <b class="caret"></b></a>
          <ul class="dropdown-menu" style="padding: 8px">
            I only close on escape
          </ul>
        </li>
      </ul>
    </div>
  </div>
</nav>

And then right after that the Alloy UI code:

<aui:script>
YUI().use(
  'aui-dropdown',
  function(Y) {
    new Y.Dropdown(
      {
        boundingBox: '#myDropdown',
        trigger: '#myTrigger',
        hideOnClickOutSide: false,
        hideOnEsc: true,
        open: true
      }
    ).render();
  }
 );
  </aui:script> 

What i get is the Dropdown link but i can't find the way to make the "I only close on Escape" dropdown when i click the trigger. Also (just in case this helps to get you guys an idea of what's going on) when i try the portlet on my website im not able to make any dropdown work even on the liferay dockbar, so i guess it's something wrong with the YUI code.

1

There are 1 answers

2
stiemannkj1 On BEST ANSWER

It is NOT possible to use the aui-dropdown in Liferay 6.2.

According to the Liferay Integration wiki article, Liferay 6.2 uses AlloyUI 2.0.x. aui-dropdown was created in commit e9b3a1035a36148f9ea75c15796d0d4d342a3452, and the first tag to contain this commit was 3.0.0pr1~164,* which means that aui-dropdown is not in AlloyUI 2.0.x.

Note: it's not possible to upgrade to a new major version of AlloyUI in Liferay either.

*Found using:

git describe --contains e9b3a1035a36148f9ea75c15796d0d4d342a3452