私はプライムフェイスと JSF 2.0 を使用しています。このような削除列を持つデータ テーブルがあります。
<p:column id="Delete" headerText="Delete">
<p:commandButton icon="delete" onclick="deleteConfirmation.show()" style="align:center">
<f:setPropertyActionListener value="#{item}" target="#{controller.selectedItem}" /> </p:commandButton>
</p:column>
//削除確認ダイアログ
<p:confirmDialog id="deleteConfirmDialog" message="Are you sure you want to delete?"
header="Delete" severity="alert"
widgetVar="deleteConfirmation">
<p:commandButton id="confirm" value="Yes"
update=":myList" oncomplete="deleteConfirmation.hide()"
actionListener="#{controller.delete}" />
<p:commandButton id="cancel" value="No"
onclick="deleteConfirmation.hide()" type="button" />
</p:confirmDialog>
データテーブルでフィルタリングを行う場合を除いて、すべてがうまく機能します。フィルタリングして削除をクリックすると、selectedItem メソッドは、現在の行ではなく、データ テーブルの前の行 (フィルタ結果の一部ではない) を取得します。
この問題は、フィルタリングなしでは存在しません。コントローラーに ViewScoped スコープを使用しています。
なぜこれが起こっているのかについてのアイデアはありますか? これはデータ テーブルでサポートされるべき基本的なことのように思えるので、ここで何か間違ったことをしていると思います。ご協力いただきありがとうございます