A.Alessio
A.Alessio

Reputation: 321

PrimeFaces orderList not updated with changed order

The order change in orderList has no effect on the list variable. I tried primefaces orderlist not getting updated with the changed order and Primefaces: How to persist reordered data from a p:orderList? and checked multiple other question, however none worked for me. I added process and update the orderList in the submitting command button, I added ajax processing to the command button, immediate to orderList, still nothing.

HTML

<p:dialog id="editDialog" widgetVar="editDialog" header="Editace dokumentu" modal="true" showEffect="fade" width="90%" height="80vh" resizable="true" closable="true" closeOnEscape="true">
   <p:outputPanel id="container" widgetVar="container" style="width: 100%; height:100%;">
     <h:form id="editTable" widgetVar="editTable">
      <p:panelGrid layout="grid" columns="2" columnClasses="label,value" styleClass="ui-panelgrid-blank" rendered="#{documentsInboxView.pdfFileType}">
        <p:outputLabel value="Pořadí stránek" for="@next" rendered="#{documentsInboxView.filePagesNumber gt 1}"/>
        <h:form rendered="#{documentsInboxView.filePagesNumber gt 1}">
                 <p:orderList value="#{documentsInboxView.pagesOrder}" var="page" itemValue="#{page}" itemLabel="#{page}" style="width: 100%;" controlsLocation="right" responsive="true" id="pagesOrderOrderList" widgetVar="pagesOrderOrderList" immediate="true">                        
                  <p:column>
                    <h:outputText value="#{page}" />
                  </p:column>
                </p:orderList>
                <p:commandButton ajax="true" type="submit" value="Změnit pořadí" onstart="PF('blockUIWidget').show();" oncomplete="PF('blockUIWidget').hide();" actionListener="#{documentsInboxView.changePagesOrder}" immediate="true" update="@widgetVar(container) @widgetVar(pagesOrderOrderList)" process="@this @widgetVar(pagesOrderOrderList)"/>
        </h:form>
     </p:panelGrid>
    </h:form>
  </p:outputPanel>
</p:dialog>

Upvotes: 1

Views: 806

Answers (1)

A.Alessio
A.Alessio

Reputation: 321

Adding ajax to the orderList with processing and updating the orderList solved the issue.

<p:orderList value="#{documentsInboxView.pagesOrder}" var="page" itemValue="#{page}" itemLabel="#{page}" style="width: 100%;" controlsLocation="right" responsive="true" id="pagesOrderOrderList" widgetVar="pagesOrderOrderList" immediate="true">  
    <p:ajax event="reorder" process="@this" update="@this"/>                      
    <p:column>
       <h:outputText value="#{page}" />
    </p:column>
 </p:orderList>

Upvotes: 1

Related Questions