0
votes

Expected function is, I'm deleting a row from my primefaces datatable and adding the deleted list to another datatable. It works fine with the list until it reaches the last row. Actual issue is after deleting the last row it never updates itself datatable (both datatables original and deleted datatable properties list).

Here is the code

<p:outputPanel id="ontProp" styleClass="ontologyProperties">
<p:panelGrid id="propertiesDetail" columns="1" styleClass="ontoProperties"
            rendered="#{not empty managebean.listedProperties}" >
    <p:outputLabel id="propLabel" value="Available Properties" styleClass="propLabel"/>

    <p:dataTable id="properties" scrollable="true" scrollHeight="200" var="prop"
                value="#{managebean.listedProperties}" styleClass="propertiesList"
                selection="#{managebean.addProperties}" rowKey="#{prop.name}"
                rendered="#{not empty managebean.listedProperties}"
                rowStyleClass="#{prop.objProp == true ? 'objprop' : null }
                #{prop.objProp == false ? 'dataprop' : null}
                #{prop.hasRestrictions == true ? 'restriction' : null}">

        <p:column selectionMode="multiple" style="width:30px;text-align:center"/>
        <p:column headerText="Domain" width="auto">
            <div align="center">
                <ui:repeat value="#{prop.domains}" var="domain">
                    <li><h:outputText value="#{domain.name}"/></li>
                </ui:repeat>
            </div>
        </p:column>
        <p:column headerText="Property" width="auto">
            <div align="center">
                <h:outputText id="opPropName" value=" #{prop.name}"/>
            </div>
        </p:column>
        <p:column headerText="Range" width="auto">
            <div align="center">
                <ui:repeat value="#{prop.objRanges}" var="range">
                    <li><h:outputText value="#{range.name}"/></li>
                </ui:repeat>
            </div>
        </p:column>                          
        <f:facet name="footer">
            <div align="left">
                <p:commandButton id="cmdPruneProp" actionListener="#{managebean.savePropertiesForClass()}"
                        icon="ui-icon-plus" update=":topForm:form:growl :topForm:form:properties 
                        :topForm:form:remProp" value="#{msg['apply.pruneProperties']}" >
                </p:commandButton>
            </div>
        </f:facet>
    </p:dataTable>

    <p:dataTable id="remProp" scrollable="true" scrollHeight="200" var="prop"
                value="#{managebean.selectedProperties}" styleClass="propertiesList"
                rowKey="#{prop.name}" rowStyleClass="#{prop.objProp == true ? 'objprop' : null }
                #{prop.objProp == false ? 'dataprop' : null} #{prop.hasRestrictions == true ? 'restriction' : null}">

        <p:column headerText="Domain" width="auto">
            <div align="center">
                <ui:repeat value="#{prop.domains}" var="domain">
                    <li><h:outputText value="#{domain.name}"/></li>
                </ui:repeat>
            </div>
        </p:column>
        <p:column headerText="Property" width="auto">
            <div align="center">
                <h:outputText id="rpropName" value=" #{prop.name}"/>
            </div>
        </p:column>
        <p:column headerText="Range" width="auto">
            <div align="center">
                <ui:repeat value="#{prop.objRanges}" var="range">
                    <li><h:outputText value="#{range.name}"/></li>
                </ui:repeat>
            </div>
        </p:column>
        <p:column headerText="Remove">
            <div align="center">
                <p:commandButton id="removeButton" icon="ui-icon-closethick" title="Remove"
                    action="#{managebean.removePropertiesForClass}"
                    update=":topForm:form:growl :topForm:form:properties
                    :topForm:form:remProp">
                    <f:setPropertyActionListener value="#{prop}"
                    target="#{managebean.ontologicalPropertyDTO}"/>
                </p:commandButton>
            </div>
        </p:column>
    </p:dataTable>                                           
</p:panelGrid>

I'm using primefaces 5.1. Appreciate your help.

1

1 Answers

0
votes

you should use a unique identifier for a row, try using another rowKey for both datatbles