0
當我做出選擇DataTable中後,它給下面錯誤選擇的dataTable
[javax.faces.FacesException: DataModel must implement org.primefaces.model.SelectableDataModel when selection is enabled or you need to define rowKey attribute]]
但在我的dataTable rowKey屬性已經定義錯誤,我檢查了它的價值是獨一無二的。可能是什麼原因可能我收到此錯誤
DataTable的代碼如下
<p:dataTable id="scenarioDataTableId" var="scenarioDataTable" value="#{myBean.scenarioApplicationColumnBOList}" tableStyle="width:90%" rowKey="scenarioDataTable.scenarioApplicationColumnId" selection="#{myBean.selectedScenarioApplicationColumnRow}" >
<f:facet name="header">Database Columns That will be updated in this Scenario</f:facet>
<p:ajax event="rowSelectRadio" listener="#{myBean.editSelectedScenarioApplicationColumnAction}"></p:ajax>
<p:column selectionMode="single" style="width:10%" />
<p:column id="Id" headerText="Id" >
#{scenarioDataTable.scenarioApplicationColumnId}
</p:column>
<p:column id="scenarioId" headerText="Scenario Id" >
#{scenarioDataTable.scenarioId}
</p:column>
<p:column id="appId" headerText="Application Column Id" >
#{scenarioDataTable.applicationColumnId}
</p:column>
<p:column id="tableNameId" headerText="Table Name" >
#{scenarioDataTable.tableName}
</p:column>
<p:column id="columnNameId" headerText="Column Name" >
#{scenarioDataTable.columnName}
</p:column>
<p:column id="columnValidValueId" headerText="Column Valid Value" >
#{scenarioDataTable.columnValidValue}
</p:column>
<p:column id="dbActionId" headerText="DB Action" >
#{scenarioDataTable.dbAction}
</p:column>
<f:facet name="footer">
<p:commandButton value="Add New Row" action="#{myBean.openDialogScenarioUpdateColumn}" oncomplete="dialogScenarioUpdateColumn.show()" rendered="#{myBean.scenarioInputFieldRendered}"></p:commandButton>
<p:spacer width="20" ></p:spacer>
<p:commandButton id="editButton" value="Edit" action="#{myBean.editSelectedScenarioApplicationColumnAction}" update=":formSelectCriteria:ScenarioMainPanel" ></p:commandButton>
<p:spacer width="20" ></p:spacer>
<p:commandButton id="deleteButton" value="Delete"></p:commandButton>
</f:facet>
</p:dataTable>
oh..silly錯誤。你知道我一整天都在打擾我。無論如何感謝指出錯誤 – SXV