我有这个简单的页面:
<h:form id="form">
<p:dataTable value="#{testBean.unitTypeModel}" var="elem" lazy="true" rows="10">
<p:column headerText="class">#{elem.class.simpleName}</p:column>
<p:column headerText="code">#{elem.code}</p:column>
<p:column headerText="description">#{elem.description}</p:column>
<p:column headerText="action">
<p:commandButton action="test2" icon="ui-icon ui-icon-wrench" value="edit">
<f:setPropertyActionListener target="#{testBean.selection}" value="#{elem}"/>
</p:commandButton>
</p:column>
</p:dataTable>
<p:commandButton action="test2" icon="ui-icon ui-icon-wrench"/>
</h:form>
内部不工作,只是刷新页面CommandButton
。DataTable
但是外面的那个正在工作。
如果我改变这种方式value
:lazy
<h:form id="form">
<p:dataTable value="#{testBean.unitTypeModel.load(0, 10, null, null, null)}" var="elem" lazy="false" rows="10">
<p:column headerText="class">#{elem.class.simpleName}</p:column>
<p:column headerText="code">#{elem.code}</p:column>
<p:column headerText="description">#{elem.description}</p:column>
<p:column headerText="action">
<p:commandButton action="test2" icon="ui-icon ui-icon-wrench" value="edit">
<f:setPropertyActionListener target="#{testBean.selection}" value="#{elem}"/>
</p:commandButton>
</p:column>
</p:dataTable>
<p:commandButton action="test2" icon="ui-icon ui-icon-wrench"/>
</h:form>
内部就像一个魅力CommanButton
。DataTable
有人知道为什么吗?
这是一个错误吗?
我上线了
- 玻璃鱼 3.1.2
- JSF 2.1.11 (莫哈拉)
- PrimeFaces 3.4-快照