3 Replies Latest reply on Oct 6, 2008 7:06 PM by igor_d

    client side API for <rich:tree>

    igor_d

      Hi All,

      is there any client side API functions for <rich:tree>, same like for modal panel you can use:

      #{rich:component('mp')}.show()

      or for calendar:
      Richfaces.getComponent('calendar',element).api_function_name(parameters)

      What I want is to have something like (at least):
      #{rich:component('myTree')}.unSelect()

      so it will un-select whatever was selected.
      or:
      #{rich:component('myTree')}.collapseAll()

      #{rich:component('myTree')}.expandAll()

      And the best thing would be:
      #{rich:component('myTree')}.expand(node);
      #{rich:component('myTree')}.select(node);
      

      If it's not possible, is there any plans to implement it?

      Thank you,
      Igor

        • 1. Re: client side API for <rich:tree>
          anders.norgaard

          Does it have to be client side?

          For me the combination of AJAX tree and server side stateAdvisor works great

          <rich:tree value="#{cpemanager.propertiesTree()}" var="item" nodeFace="#{item.type()}" id="conftree" stateAdvisor="#{treestateadvisor}" changeExpandListener="#{treestateadvisor.processExpansion()}">


          Best,
          Anders

          • 2. Re: client side API for <rich:tree>
            ilya_shaikovsky

            public JS API requests present in jira but not availble for now. vote in jira on at wiki requests page.

            • 3. Re: client side API for <rich:tree>
              igor_d

              Hi biehl,

              yes, I know you can use AJAX re-rendering of a tree, but we have a massive form and a menu tree, so it takes 4-5 seconds to re-render the tree (even with ajaxsingle="true", limitToList="true" and immediate="true").
              We have navigation links outside of the menu tree, if a user clicks on that link it should expand and select the appropriate menu item in the menu.
              The most effective way to do this is via JS IMHO.
              Currently I use jsFunction for that (tried to make it asynchronous):

              <a:jsFunction name="setSelectedMenuItem" eventsQueue="myAjaxQueue" ignoreDupResponses="true" ajaxSingle="true" limitToList="true" immediate="true" reRender="treeMenu">
               <a:actionparam name="panelId" assignTo="#{treeStateAdvisor.selectedPanelId}" />
              </a:jsFunction>
              

              And in the outside link:
              <a:commandLink value="#{node.label}" onclick="javascript:setSelectedMenuItem('#{node.panelId}');return false;"/>
              


              Thanks, Ilya, I will vote for that.

              Thanks, guys,
              Igor