我有一個簡單的問題,但我無法找到正確的答案。通過RowEditEvent獲取rowIndex
我呈現一個數據表,這是非常複雜的:
<p:dataTable var="label" value="#{labelsManager.labelsList}" rowKey="#{label.cod}" editable="true"
rowsPerPageTemplate="5,10,15,30" paginator="true" paginatorPosition="bottom" rows="30"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rendered="#{not empty labelsManager.labelsList}" scrollable="true" scrollHeight="300" id="labelsList" sortMode="multiple"
selection="#{labelsManager.selectedLabelsForDelete}">
<p:ajax event="rowEdit" listener="#{labelsManager.onRowEdit}" />
...some code...
</dataTable>
和方法
public void onRowEdit(RowEditEvent event) {
... here I want to get the index on the current row...
}
當我想編輯的行我想也得到當前行的指數,這將被編輯。我搜索了很多,但我看不到如何從RowEditEvent中提取id。
我也嘗試將行的索引作爲屬性發送,但沒有成功。有任何想法嗎?謝謝!
我想買一個的ID它將被更新的行中的單元格創建爲動態。例如(tableForm:labelsList:1:myId)其中1是rowIndex – Aditzu 2015-01-15 15:47:44
您可以使用''在bean中設置rowIndex值,您是否嘗試過? –
Pellizon
2015-01-15 15:51:56
是的,我已經試圖把rowEditor但我得到一個錯誤,如「父不是類型的ActionSource,類型是:[email protected] 」 –
Aditzu
2015-01-15 15:56:30