0 Replies Latest reply on Jun 26, 2009 12:15 PM by jdsuboy

    Having problems with HtmlDropSupport

    jdsuboy

      I want to dynamically create drop support for richfaces controls.

      I originally created a page that had a data grid and I dropped items into it and it worked fine, but I needed to add this support dynamically, so I wrote code that added HtmlDropSupport to my HtmlDataGrid.

      The code works, but it never calls my processDrop command now. It shows the correct image over items that accept the drop, but when I drop the item my processDrop never gets called.

      this is the rich tag I originally had:

      <rich:dropSupport acceptedTypes="foo"
       dropListener="#{programTable.processDrop}"
       dropValue="#{program}"
       reRender="pt">
      </rich:dropSupport>


      and this is the HtmlDropSupport code I wrote:
       HtmlDropSupport dropSupport = new HtmlDropSupport( );
       dropSupport.setAcceptedTypes( "foo" );
       dropSupport.setReRender( "pt" );
      
       FacesContext fc = FacesContext.getCurrentInstance( );
      
       MethodBinding mb = fc.getApplication( )
       .createMethodBinding( "#{programTable.processDrop}"
       , new Class[ ]{ DropEvent.class } );
      
       dropSupport.setDropListener( mb );
      
       ValueExpression ve = fc.getApplication( )
       .getExpressionFactory( )
       .createValueExpression( fc.getELContext( )
       , "#{program}"
       , Program.class );
       dropSupport.setValueExpression( "dropValue", ve );
      
       this.getChildren( ).add( dropSupport );
       dropSupport.setParent( this );
      


      I cant get it to call the processDrop function. Is there something I am doing wrong???