简体   繁体   中英

Primefaces datatable: partial processing on row selection

I have a primefaces datatable with ajax events to handle multiple row selection. Within the table I also have some in-place editing components. The problem is that whenever I select a row, the whole table gets processed, including the input components.

Is there a way to only process the row selections, not the inputs?

example xhtml...

<p:dataTable value="#{controller.data}" var="d" rowKey="#{d.id}"
             selection="#{controller.selected}" rowSelectMode="add">

    <p:ajax event="rowSelect" partialSubmit="true" process="@this"
            update=":anotherComponent"/>
    <!-- ...and other events -->

    <p:column selectionMode="multiple"/>

    <p:column>
        <p:inplace editor="true" saveLabel="Apply changes" >
            <p:inputText value="#{d.value}"/>
            <p:ajax event="save" partialSubmit="true" process="@this" 
                    listener="#{controller.saveChanges(d)}"/>
        </p:inplace>
    </p:column>

    <!-- ...and other columns -->
</p:dataTable>

Unfortunately there is no official way to do this. I reported this to the PF team a half year ago and they promised that they will introduce something like process="@onlyThis" , but there is no ETA for this enhancement.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM