找到你要的答案

Q:Why are the acceptedTypes not set in Richfaces Drag and Drop?

Q:为什么不在RichFaces拖放acceptedtypes?

I've tested the Example from Richfaces DragandDrop draging is working correctly, but every time i try to drop an element at the dropzone, it's being rejected.

  <rich:dragIndicator id="indicator" />
            <h:panelGrid columnClasses="panelc" columns="2" width="100%">

                <rich:panel>
                    <f:facet name="header">
                        <h:outputText value="Verfügbare Spalten" />
                    </f:facet>
                    <h:dataTable id="src" columns="1"
                        value="#{columnBean.possibleColumns}" var="col">

                        <h:column>

                            <a4j:outputPanel
                                style="width:100px;border:1px solid gray;padding:2px"
                                onmouseover="this.style.cursor='move'" layout="block">
                                <rich:dragSupport dragIndicator=":indicator" dragType="#{columnBean.test}"
                                    dragValue="#{col}">
                                    <rich:dndParam name="label" value="#{col.label}" />
                                </rich:dragSupport>
                                <h:outputText value="#{col.label}" />
                                <!--        <br />
                            <h:selectBooleanCheckbox id="#{col.id}Possible"
                                    value="#{col.rendered}"
                                    style="width:100%;margin-left:auto; margin-right:auto" />-->
                            </a4j:outputPanel>
                        </h:column>
                        <f:facet name="footer">
                            <a4j:commandButton value="Reset" action="#{columnBean.reset}"
                                reRender="src,activeColumns" />
                        </f:facet>
                    </h:dataTable>
                </rich:panel>


                <h:panelGrid columns="3" width="100%">

                    <rich:panel style="width:90%">
                        <f:facet name="header">
                            <h:outputText value="Aktive Spalten" />
                        </f:facet>

                        <rich:dropSupport acceptedTypes="#{columnBean.test}"
                            dropListener="#{columnBean.processDrop}"  
                            reRender="activeColumn,src">
                        </rich:dropSupport>

                        <h:dataTable id="activeColumns" columns="1"
                            value="#{columnBean.columns}" var="column">
                            <h:column>
                                <h:outputText value="#{column.label}"
                                    style="border:1px solid gray" />
                            </h:column>
                        </h:dataTable>

                    </rich:panel>

                </h:panelGrid>
            </h:panelGrid>

When I look in my browsers-developertools i can see that acceptedType is empty. Even if I set the dragType and the acceptedType as a String.

I speculate that this error has something to do with lifreay 6.2.3 interfering the setting. Am I right?

我从Richfaces DragandDrop拖动实例验证是正确的工作,但每一次我试着在DropZone元素下降,它被拒绝了。

  <rich:dragIndicator id="indicator" />
            <h:panelGrid columnClasses="panelc" columns="2" width="100%">

                <rich:panel>
                    <f:facet name="header">
                        <h:outputText value="Verfügbare Spalten" />
                    </f:facet>
                    <h:dataTable id="src" columns="1"
                        value="#{columnBean.possibleColumns}" var="col">

                        <h:column>

                            <a4j:outputPanel
                                style="width:100px;border:1px solid gray;padding:2px"
                                onmouseover="this.style.cursor='move'" layout="block">
                                <rich:dragSupport dragIndicator=":indicator" dragType="#{columnBean.test}"
                                    dragValue="#{col}">
                                    <rich:dndParam name="label" value="#{col.label}" />
                                </rich:dragSupport>
                                <h:outputText value="#{col.label}" />
                                <!--        <br />
                            <h:selectBooleanCheckbox id="#{col.id}Possible"
                                    value="#{col.rendered}"
                                    style="width:100%;margin-left:auto; margin-right:auto" />-->
                            </a4j:outputPanel>
                        </h:column>
                        <f:facet name="footer">
                            <a4j:commandButton value="Reset" action="#{columnBean.reset}"
                                reRender="src,activeColumns" />
                        </f:facet>
                    </h:dataTable>
                </rich:panel>


                <h:panelGrid columns="3" width="100%">

                    <rich:panel style="width:90%">
                        <f:facet name="header">
                            <h:outputText value="Aktive Spalten" />
                        </f:facet>

                        <rich:dropSupport acceptedTypes="#{columnBean.test}"
                            dropListener="#{columnBean.processDrop}"  
                            reRender="activeColumn,src">
                        </rich:dropSupport>

                        <h:dataTable id="activeColumns" columns="1"
                            value="#{columnBean.columns}" var="column">
                            <h:column>
                                <h:outputText value="#{column.label}"
                                    style="border:1px solid gray" />
                            </h:column>
                        </h:dataTable>

                    </rich:panel>

                </h:panelGrid>
            </h:panelGrid>

When I look in my browsers-developertools i can see that acceptedType is empty. Even if I set the dragType and the acceptedType as a String.

我推测,这个错误是lifreay 6.2.3干扰设置。我搞对了吗?

jsf  drag-and-drop  richfaces  liferay-6  jsf-1.2