【发布时间】:2015-05-02 23:58:26
【问题描述】:
我正在使用 PrimeFaces 5.1,当用户使用以下代码单击 p:dataTable 行时,我调用 history.pushState:
<p:dataTable value="#{associateBean.scenarios}"
selectionMode="single"
selection="#{associateBean.selectedScenarioViewBean}"
var="scenarioViewBean" rowKey="#{scenarioViewBean.id}">
<p:ajax event="rowSelect"
listener="#{associateBean.onScenarioRowSelect}"
oncomplete="history.pushState('','','test#{scenarioViewBean.id}')"
update="@form"/>
<p:column>
<h:outputText value="#{scenarioViewBean.name}"/>
</p:column>
</p:dataTable>
如您所见,我正在尝试将 scenarioViewBean.id 值传递给我的 pushState 调用。
问题在于#{scenarioViewBean.id} 不返回任何内容,因此 JavaScript 在 URL 中推送“test”而不是“test123”。
我该如何解决这个问题?
【问题讨论】:
标签: javascript jsf primefaces datatable pushstate