0 Replies Latest reply on Apr 21, 2012 7:46 AM by omid pourhadi

    how to add Component To Ajax Render

    omid pourhadi Newbie

      Hi guys,

      i have a tree with drag & drop support after dragging an item, tree doesn't update until i refresh page 

      i'm using richfaces 3.3.0

       

       

      public void dropListener(DropEvent dropEvent)
          {
              Dropzone dropzone = (Dropzone) dropEvent.getComponent();
              Object dragValue = dropEvent.getDragValue();
              Object dropValue = dropzone.getDropValue();
      
              if (dragValue instanceof ProjectView)
              {
                  handleProject((ProjectView) dragValue, (ProjectView) dropValue);
      
              }
      
              addTreeToRerender();
          }
      
          private void handleProject(ProjectView dragValue, ProjectView dropValue)
          {
              getEntityManager().createNamedQuery(Projwbs.UPDATE_WBS_BY_PARENT_ID).setParameter(1, dropValue.getWbsId())
                      .setParameter(2, dragValue.getWbsId()).executeUpdate();
      
          }
      
          private void addTreeToRerender()
          {
              try
              {
      
                  AjaxContext ac = AjaxContext.getCurrentInstance(facesContext);
                  UIComponent destTree = facesContext.getViewRoot().findComponent("projectTreeForm");
                  ac.addComponentToAjaxRender(destTree);
                  ac.addAreasToProcessFromComponent(facesContext, destTree);
      
              }
              catch (Exception e)
              {
                  System.err.print(e.getMessage());
              }
          }
      
      

       

      the addTreeToRender seems refresh the tree but item is still in the last state

      Actually it's really wierd when i create a button and run this method it works

       

      <a:commandButton value="refresh"  reRender="treeList" action="#{projectTreeSearch.addTreeToRerender}" />
      

      do you know how i can fix this ?

      is this bug ?