Delete elements from a dynamically updated data table

Discussão em 'StackOverflow' iniciado por Stack, Janeiro 16, 2021.

  1. Stack

    Stack Membro Participativo

    I have a Richfaces 1.2 dataTable that is updated every 2 seconds using a a4j:poll request. It sends a request to the server and reRender the table adding new elements and changing the state of existing elements.

    On top of that, I want to be able to delete rows from this table using a button, but the problem is that it’s possible to send a delete request (button) AND an update request (poll) at the same time, causing a concurrent call exception.

    Any ideias on how to keep the table dynamically updated and be able to send delete requests at the same time? What I was trying to do is blocking the poll request when a delete button is clicked, make the delete request, and then get back at sending requests to update the table.

    Queue of requests maybe?

    Here's a simplified snippet of the code:

    <a:form id="orders">

    <a:poll id="pollUpdateOrders"
    interval="2000"
    reRender="outputPanelOrders, pollUpdateOrders"
    action="#{bean.getOrders()}" />

    <a:eek:utputPanel id="outputPanelOrders">

    <r:dataTable id="tabelOrders"
    title="Orders" var="orders"
    value="#{bean.getOrders()}" >

    <r:column>
    <f:facet name="header">
    <h:eek:utputText value="Code" />
    </f:facet>
    <h:eek:utputText
    value="#{order.code}" />
    </r:column>

    <r:column>
    <f:facet name="header">
    <h:eek:utputText value="Description" />
    </f:facet>
    <h:eek:utputText
    value="#{order.description}" />
    </r:column>

    <r:column>
    <a:commandLink id="deleteOrder"
    action="#{bean.deletOrder(order)}" />
    </r:column>
    </r:dataTable>
    </a:eek:utputPanel>
    </a:form>

    Continue reading...

Compartilhe esta Página