Forums de discussion

Configuring JSON handler for Alloy UI TreeView Portlet

thumbnail
Jeff Wilson, modifié il y a 13 années.

Configuring JSON handler for Alloy UI TreeView Portlet

New Member Publications: 11 Date d'inscription: 31/01/07 Publications récentes
I am creating a portlet which uses Alloy UI TreeView in a context where the nodes need to be dynamically populated. However, I have been unable to determine how to configure an appropriate server-side handler to respond to TreeView action requests.

The simple TreeView definition I am using is included below. When the static root node is expanded, the Portlet class' processAction method is called with the parameter 'javax.portlet.action' = 'getChildren'. The 'id' parameter does not appear to be similarly posted.

However, I would expect the correct way to handle these requests is not in the processAction method, but rather to define an action mapping that would route the request to the appropriate handler. I have been unable to determine the actual method of doing this, as the server-side issues are implied in the examples I have found, but never directly addressed.

Any suggestions would be greatly appreciated. Many thanks in advance!
-Jeff


      <aui:script use="aui-tree-view">

        var children = [{
          label: 'root',
          id: '0',
          expanded: false,
          draggable: false,
          type: 'io'
        }];

        var tree = new A.TreeView({
          io: {
             cache: false,
             url: '<portlet:actionurl name="getChildren" windowstate="<%=LiferayWindowState.EXCLUSIVE.toString()%>"></portlet:actionurl>',
          },
          type: 'normal',
          boundingBox: '#xml_tree',
          children: children
        })
        .render();

      </aui:script>
      <div id="xml_tree"></div>