Using a p:remoteCommand to update a p:dataTable

徘徊边缘 提交于 2019-12-01 06:31:29
BalusC

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"/>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!