Using a p:remoteCommand to update a p:dataTable

前端 未结 1 1627
轻奢々
轻奢々 2021-01-13 18:04

Given the following XHTML code that has one and a having only two columns.



        
相关标签:
1条回答
  • 2021-01-13 18:58

    After doing this, if a row held by the given <p:dataTable> is updated (which in turn, updates <p:panel id="panel"> via <p:ajax> inside <p:dataTable>. It is sometimes necessary), the given <p:inputText> in <p:panel id="panel"> causes validation its borders turn red implying violating the associated validation that should not happen.

    This isn't what is happening. If that were true, you'd have seen 3 HTTP requests in the network monitor. But there are only 2 (one from the submit of the panel and one from the <p:remoteCommand>).

    The cause is the <p:remoteCommand> itself. Its process attribute defaults to @all ("whole view"). You can also confirm this by inspecting the javax.faces.partial.execute request parameter in the network monitor. It says @all. In other words, the entire form is also submitted/processed, including those empty inputs.

    You need to explicitly set it to @this:

    <p:remoteCommand name="updateTable" process="@this" update="dataTable"/>
    
    0 讨论(0)
提交回复
热议问题