[richfaces-issues] [JBoss JIRA] Commented: (RF-10947) rich:dragSource doesn't work after being rerendered via ajax

Richard Wähner (JIRA) jira-events at lists.jboss.org
Mon Sep 5 04:18:26 EDT 2011


    [ https://issues.jboss.org/browse/RF-10947?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12626160#comment-12626160 ] 

Richard Wähner commented on RF-10947:
-------------------------------------

I've written a small example to demonstrate the issue.

{code:title=DragAndDrop.xhtml|borderStyle=solid}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:a4j="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich">
    <h:head>
        <title>Homepage</title>
    </h:head>
    
    <h:body>
        <h:form>
        
            <a4j:commandButton value="Render" action="#{dataprovider.setVisible}" render="@form"/>
        
        <br/>
        
        <h:panelGrid columns="2" width="100%" id="dragDrop" rendered="#{dataprovider.render()}">
 
            <rich:panel style="width:133px">
                <f:facet name="header">
                    <h:outputText value="Source List" />
                </f:facet>
                <h:dataTable id="srcTable" columns="1" value="#{dataprovider.unassigned}" var="fm">
                    <h:column>
                        <a4j:outputPanel>
                            <rich:dragSource type="dragType" dragValue="#{fm}" />
                            <h:outputText value="#{fm.name}"></h:outputText>
                        </a4j:outputPanel>
                    </h:column>
                </h:dataTable>
            </rich:panel>
 
            <rich:panel>
                <f:facet name="header">
                    <h:outputText value="Target List" />
                </f:facet>
                <rich:dropTarget acceptedTypes="dragType" dropValue="unassigned" render="targetTable, srcTable" />
 
                <h:dataTable id="targetTable" columns="1" value="#{dataprovider.assigned}" var="fm">
                    <h:column>
                        <h:outputText value="#{fm.name}"></h:outputText>
                    </h:column>
                </h:dataTable>
            </rich:panel>
            </h:panelGrid>
        
        </h:form>
    </h:body>
</html>
{code}

Rerendering produces no new html code.

HTML code before and after rerendering:

{code}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
        <title>Homepage</title><link type="text/css" rel="stylesheet" href="/DragAndDrop/faces/rfRes/skinning.ecss?db=eAFLq7x7HgAFkAKM" /><script type="text/javascript" src="/DragAndDrop/faces/javax.faces.resource/jsf.js?ln=javax.faces&amp;stage=Development"></script><script type="text/javascript" src="/DragAndDrop/faces/javax.faces.resource/jquery.js"></script><script type="text/javascript" src="/DragAndDrop/faces/javax.faces.resource/richfaces.js"></script><script type="text/javascript" src="/DragAndDrop/faces/javax.faces.resource/richfaces-queue.js"></script><link type="text/css" rel="stylesheet" href="/DragAndDrop/faces/rfRes/panel.ecss?db=eAFLq7x7HgAFkAKM&amp;ln=org.richfaces" /></head><body>
<form id="j_idt6" name="j_idt6" method="post" action="/DragAndDrop/faces/index.xhtml" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="j_idt6" value="j_idt6" />
<input id="j_idt6:j_idt7" name="j_idt6:j_idt7" onclick="RichFaces.ajax(&quot;j_idt6:j_idt7&quot;,event,{&quot;incId&quot;:&quot;1&quot;} );return false;" value="Render" type="submit" />
        
        <br /><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="9190928830501584140:-730868217844963347" autocomplete="off" />
</form></body>
</html>
{code}


The HTML code should look like this after button was clicked:

{code}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
        <title>Homepage</title><link type="text/css" rel="stylesheet" href="/DragAndDrop/faces/rfRes/skinning.ecss?db=eAFLq7x7HgAFkAKM" /><script type="text/javascript" src="/DragAndDrop/faces/javax.faces.resource/jsf.js?ln=javax.faces&amp;stage=Development"></script><script type="text/javascript" src="/DragAndDrop/faces/javax.faces.resource/jquery.js"></script><script type="text/javascript" src="/DragAndDrop/faces/javax.faces.resource/richfaces.js"></script><script type="text/javascript" src="/DragAndDrop/faces/javax.faces.resource/richfaces-queue.js"></script><link type="text/css" rel="stylesheet" href="/DragAndDrop/faces/rfRes/panel.ecss?db=eAFLq7x7HgAFkAKM&amp;ln=org.richfaces" /></head><body>
<form id="j_idt6" name="j_idt6" method="post" action="/DragAndDrop/faces/index.xhtml" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="j_idt6" value="j_idt6" />
<input id="j_idt6:j_idt7" name="j_idt6:j_idt7" onclick="RichFaces.ajax(&quot;j_idt6:j_idt7&quot;,event,{&quot;incId&quot;:&quot;1&quot;} );return false;" value="Render" type="submit" />
        
        <br /><table id="j_idt6:dragDrop" width="100%">
<tbody>
<tr>
<td><div class="rf-p " id="j_idt6:j_idt9" style="width:133px"><div class="rf-p-hdr " id="j_idt6:j_idt9_header">Source List</div><div class="rf-p-b " id="j_idt6:j_idt9_body"><table id="j_idt6:srcTable">

<tbody>
<tr>
<td><span id="j_idt6:srcTable:0:j_idt12">Daniel</span></td>
</tr>
<tr>
<td><span id="j_idt6:srcTable:1:j_idt12">Peter</span></td>
</tr>
</tbody>
</table>
</div></div></td>
<td><div class="rf-p " id="j_idt6:j_idt15"><div class="rf-p-hdr " id="j_idt6:j_idt15_header">Target List</div><div class="rf-p-b " id="j_idt6:j_idt15_body"><table id="j_idt6:targetTable">
<tbody>
<tr>
<td>Franz</td>

</tr>
<tr>
<td>Christin</td>
</tr>
</tbody>
</table>
</div></div></td>
</tr>
</tbody>
</table>
<input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="-4097672622419417816:-8071100684377869057" autocomplete="off" />
</form><script type="text/javascript" src="/DragAndDrop/faces/javax.faces.resource/jquery.position.js"></script><script type="text/javascript" src="/DragAndDrop/faces/javax.faces.resource/richfaces-base-component.js"></script><script type="text/javascript" src="/DragAndDrop/faces/javax.faces.resource/richfaces-event.js"></script><script type="text/javascript" src="/DragAndDrop/faces/javax.faces.resource/jquery-ui-core.js?ln=org.richfaces"></script><script type="text/javascript" src="/DragAndDrop/faces/javax.faces.resource/jquery-dnd.js?ln=org.richfaces"></script><script type="text/javascript" src="/DragAndDrop/faces/javax.faces.resource/dnd-draggable.js?ln=org.richfaces"></script><script type="text/javascript" src="/DragAndDrop/faces/javax.faces.resource/dnd-droppable.js?ln=org.richfaces"></script><script type="text/javascript">$(document).ready(function() {
new RichFaces.ui.Draggable("j_idt6:srcTable:0:j_idt13",{"parentId":"j_idt6:srcTable:0:j_idt12","indicator":null,"type":"dragType"} )
new RichFaces.ui.Draggable("j_idt6:srcTable:1:j_idt13",{"parentId":"j_idt6:srcTable:1:j_idt12","indicator":null,"type":"dragType"} )
new RichFaces.ui.Droppable("j_idt6:j_idt17",{"parentId":"j_idt6:j_idt15","ajaxFunction":function(event,dragSourceId){RichFaces.ajax(event["target"],event,{"parameters":{"dragSource":dragSourceId,"j_idt6:j_idt17":"j_idt6:j_idt17","org.richfaces.ajax.component":"j_idt6:j_idt17"} ,"incId":"1"} )},"acceptedTypes":["dragType"] } )
});

</script></body>
</html>
{code}

Richard

> rich:dragSource doesn't work after being rerendered via ajax
> ------------------------------------------------------------
>
>                 Key: RF-10947
>                 URL: https://issues.jboss.org/browse/RF-10947
>             Project: RichFaces
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: component-drag/drop
>    Affects Versions: 4.0.0.Final
>         Environment: mojarra 2.1.1 gf3.1 
>            Reporter: Adrian Meredith
>              Labels: draganddrop
>             Fix For: 4.1.0.Tracking
>
>
> Drag Source is not applied 
> using the following code in a composite component
> {code}
> <a4j:outputPanel layout="block" styleClass="rf-ind-drag" >
>     <rich:dragSource  type="webResult" dragValue="1"/>
>     <h:outputText value="works"></h:outputText>
> </a4j:outputPanel>
> <h:panelGroup id="content" layout="block" rendered="#{cc.attrs.rendered}" style="width: 100%; height:100%;">
> 	<a4j:outputPanel layout="block" styleClass="rf-ind-drag" >
> 		<rich:dragSource  type="webResult" dragValue="1"/>
>                 <h:outputText value="doesn't work"></h:outputText>
>         </a4j:outputPanel>
> ...
> {code}
> Basically the panel at the top is draggable, the one at the bottom (which is below the panelGroup) is not.  Looking at the source its as though dragSource isn't even there as it is rendered without any reference to it (i.e. no ui-draggable class for example).
> Drag and drop support was the main reason i'm using richfaces! so its very important to me as i one to drag rows from our table widget onto another panel for quick tagging of results.  Unfortunately I'm gonna be away for the next two weeks but It'd be good to get more information on it.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the richfaces-issues mailing list