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>
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 );