オブジェクトの配列リストを表示するために使用されるデータテーブルがあります。p:contextMenu
右ボタンでクリックしてテーブルから行を削除するために追加したいと思います。p:contextMenu
表の一番上にを追加しましたがbean.selectedIds[item.comp]
、一意の I を送信するために適切に呼び出すことができません。どうすれば問題を解決できますか? p:contextMenu
テーブル本体に追加すると機能しません。
<h:form id="form" >
<p:contextMenu for="dataTable">
<p:menuitem value="View" update="dataTable" oncomplete="carDialog.show()"/>
<p:menuitem value="Delete" update="dataTable" actionListener="#{bean.selectedIds}"/>
</p:contextMenu>
<!-- The sortable data table -->
<h:dataTable id="dataTable" headerClass="columnHeader" value="#{bean.dataList}" binding="#{table}" var="item">
<!-- Check box -->
<h:column>
<h:selectBooleanCheckbox onclick="highlight(this);" value="#{bean.selectedIds[item.comp]}" />
</h:column>
<!-- Row number -->
<h:column>
<f:facet name="header">
<h:outputText value="№" />
</f:facet>
<h:outputText value="#{table.rowIndex + bean.firstRow + 1}" />
</h:column>
<h:column>
<f:facet name="header">
<h:commandLink value="comp ID" actionListener="#{bean.sort}" style="text-decoration:none; color:white;">
<f:attribute name="sortField" value="comp" />
<f:ajax render="@form" />
</h:commandLink>
</f:facet>
<h:outputText value="#{item.comp}" />
</h:column>
........
</h:dataTable>
</h:form>