我有一个 phaseListener 应该将data属性设置为dataTable中的primefaces列
public class NewFeaturesListener implements PhaseListener {
@Override
public void afterPhase(PhaseEvent phaseEvent) {
// Do nothing here
}
@Override
public void beforePhase(PhaseEvent phaseEvent) {
process(phaseEvent.getFacesContext().getViewRoot(), "column7WarrantyFix");
}
@Override
public PhaseId getPhaseId() {
return PhaseId.RENDER_RESPONSE;
}
private void process(UIComponent component, String... ids) {
// Go to every child
for (UIComponent child : component.getChildren()) {
// If component has a given ID then check if you can rendered it
for (String id : ids)
if (id.equals(child.getId())) {
child.setRendered(false);
}
// Process next node
process(child, ids);
}
}
}
这是我的专栏
<p:column id="column7WarrantyFix">
<f:facet name="header">
<h:outputText value="#{appMsg.admin_warranty_fix}" />
</f:facet>
<h:selectBooleanCheckbox value="#{item.object.isWarrantyFix}">
<f:ajax value="change" execute="@this" render="@form"
listener="#{MyBean.warrantyChanged}"/>
</h:selectBooleanCheckbox>
</p:column>
但遗憾的是没有任何反应。此列显示在界面中。但是当我将主要标签p标签更改为&#34; h:&#34;一切正常。为什么我不能用primefaces做同样的事情呢?
答案 0 :(得分:0)
因为我正在重新发明轮子决定在Bean中使用这个逻辑