0
我嘗試從我的bean中獲取選定行索引。如何獲得後臺bean中的選定行索引
在後臺bean我使用監聽
public void updateCurrent()
{
int rowIndex = dataTable.getRowIndex();
...
}
,但我總是得到-1的rowIndex
P中:dataTable中我嘗試的過程我的DataTable,並呼籲選擇排聽衆
<p:ajax event="rowSelect" listener="#{locationBean.updateCurrent}"
process=":mainTab:mainLocationForm:mainLocationTable"/>
PrimeFaces版本 - 3.4
請幫助獲取選定的行索引。謝謝。
野生猜測:你綁定'dataTable'在你的XHTML是這樣的:'
'? – Jens@Jens是的。我綁定它。並檢查該setter的dataTable調用時,我處理':mainTab:mainLocationForm:mainLocationTable' – esedin
[方法說明](http://grepcode.com/file/repo1.maven.org/maven2/javax.faces/jsf-api getRowIndex()中的/2.1/javax/faces/component/UIData.java#UIData.getRowIndex%28%29)說:「該屬性未啓用值綁定表達式。」 – Jens