Primefaces DataTable拖放式过滤器

时间:2018-07-05 21:13:36

标签: filter primefaces datatable drag jfs

我正在尝试在Primefaces数据表(https://www.primefaces.org/showcase/ui/dnd/dataTable.xhtml)中使用拖放功能,但其中包含过滤器。 一切都可以正常工作,过滤器也可以正常工作,我可以将行从一个dataTable拖到另一个。问题是,如果我过滤源数据表中的值,则拖动的项目将引用初始数据源的索引,而不是数据表中已过滤的数据源。如何拖动带有过滤值的项目?

两个dataTables的代码(两个表都在同一表格内)

<div class="ui-g-6">
    <p:fieldset id="availableRecDidacField" legend="Recursos didácticos disponibles" style="border: 1px solid #005987 !important;">
        <p:dataTable id="availableRecDidacDt" var="recurso" value="#{clase.listaRecursosDidac}" filteredValue="#{clase.listaRecursosDidacFilter}"
                     style="margin-bottom:0;" rows="10" paginator="true" rowsPerPageTemplate="5,10,15,20,25" emptyMessage="Sin recursos didacticos agregados">
            <p:column headerText="Recurso" filterBy="#{recurso.recurso}" filterMatchMode="contains">
                <h:outputText value="#{recurso.recurso}"/>
            </p:column>
            <p:column style="width:20px">
                <h:outputText id="RecDidacDragIcon" styleClass="ui-icon ui-icon-arrow-4" />
                <p:draggable for="RecDidacDragIcon" revert="true" helper="clone"/>
            </p:column>
        </p:dataTable>
    </p:fieldset>
</div>
<div class="ui-g-6">
    <p:fieldset id="selectedRecDidacField" legend="Recursos didácticos seleccionados" style="border: 1px solid #005987 !important;">
        <p:outputPanel id="RecDidacDropArea">
            <h:outputText value="Arrastre aquí..." rendered="#{empty clase.selectRecursosDidac}" style="font-size:24px;" />
            <p:dataTable id="selectedDidacDt" var="recurso" value="#{clase.selectRecursosDidac}" rendered="#{not empty clase.selectRecursosDidac}" 
                         style="margin-bottom:0;" rows="10" paginator="true" rowsPerPageTemplate="5,10,15,20,25" emptyMessage="Sin recursos didacticos seleccionados">
                <p:column headerText="Recurso">
                    <h:outputText value="#{recurso.recurso}"/>
                </p:column>
                <p:column style="width:32px">
                    <p:commandButton title="Eliminar" update="@form:recursosDidacP" icon="fa fa-trash" process="@this" actionListener="#{clase.eliminarRecursoDidac(recurso)}"/>
                </p:column>
            </p:dataTable>
        </p:outputPanel>
    </p:fieldset>
    <p:droppable id="dropRecDidac" for="selectedRecDidacField" tolerance="touch" activeStyleClass="ui-state-highlight" datasource="availableRecDidacDt"  onDrop="handleDrop">
        <p:ajax listener="#{clase.onRecursosDidacDrop}" update="@form:RecDidacDropArea,@form:availableRecDidacDt" />
    </p:droppable>
</div>

0 个答案:

没有答案