i have this simple page:
<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>
and the CommandButton
inside DataTable
is not working, just refreshes page.
but the one outside is working.
if i change value
and lazy
this way:
<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>
the CommanButton
inside DataTable
works like a charm.
someone knows why?
is it a bug?
i'm on
found out that the lazy datamodel must be the same instance on postback request, even a new instance with the very same values will not work. so it must be provided from at least a @ViewScoped
bean.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With