gpt4 book ai didi

ajax -

Unable to attach to non-ClientBehaviorHolder parent

转载 作者:行者123 更新时间:2023-12-04 10:25:30 27 4
gpt4 key购买 nike

我使用 JSF 2、primefaces 4.0 并且我尝试使用 DataTable - 单元格内编辑,因为它是在 primefaces 展示中生成的,但是我有一个错误,尽管我复制了展示中显示的相同示例
错误是

<p:ajax> Unable to attach <p:ajax> to non-ClientBehaviorHolder parent

这是 xhtmlpagecode
 <rich:panel  style="width : 800px; height : 551px; " > 
<f:facet name="header" >

<h:outputText value="Tableau des articles" align="center" style="FONT-SIZE: small;"/>
</f:facet>


<h:form id="form">

<p:dataTable id="cars" var="car" value="#{articlesbean.LMatpilotaccess1}" editable="true" editMode="cell" widgetVar="carsTable">

<f:facet name="header">
Matériel du pilotage et accessoires
</f:facet>
<p:growl id="messages" showDetail="true"/>

<p:contextMenu for="cars" widgetVar="cMenu">
<p:menuitem value="Edit Cell" icon="ui-icon-search" onclick="PF('carsTable').showCellEditor();return false;"/>
<p:menuitem value="Hide Menu" icon="ui-icon-close" onclick="PF('cMenu').hide()"/>
</p:contextMenu>


<p:column headerText="Serie" style="width:25%">
<p:ajax event="cellEdit" listenner="#{articlesbean.onCellEdit}" update=":form:messages" />

<p:cellEditor>
<f:facet name="output"><h:outputText value="#{car.serie}" /></f:facet>
<f:facet name="input"><p:inputText id="modelInput" value="#{car.serie}" style="width:96%"/></f:facet>
</p:cellEditor>
</p:column>



</p:dataTable>


</h:form>




</rich:panel>

这是我的 bean
@ManagedBean(name="articlesbean")

@ViewScoped
public class ArticlesBean implements Serializable{

@Inject
private ArticlesDAO articleDAO;
@Inject
private Matpilotaccess1 matpilotaccess1;
@Inject
private Matpilotaccess2 matpilotaccess2;
@Inject
private Poteaux poteaux ;
@Inject
private Travgc1 travgc1;
@Inject
private Travgc2 travgc2;
@Inject
private Travresurbain travresurbain;


private List LMatpilotaccess1 = new ArrayList();
private List LMatpilotaccess2 = new ArrayList();
private List LPoteaux = new ArrayList();
private List LTravgc1 = new ArrayList();
private List LTravgc2 = new ArrayList();
private List LTravresurbain = new ArrayList();




public void onCellEdit(CellEditEvent event) {
Object oldValue = event.getOldValue();
Object newValue = event.getNewValue();

if(newValue != null && !newValue.equals(oldValue)) {
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Cell Changed", "Old: " + oldValue + ", New:" + newValue);
FacesContext.getCurrentInstance().addMessage(null, msg);
}
}

//// Getters and setters

最佳答案

您嵌套了 <p:ajax>里面<p:column> . <p:ajax>需要嵌套在实现 ClientBehaviorHolder interface 的组件中.然而, Column component class后面 <p:column>不执行它。 DataTable component class后面 <p:dataTable>实现它。

你应该嵌套 <p:ajax><p:dataTable>反而:

<p:dataTable ...>
<p:ajax ... />

<p:column ...>
...
</p:column>
</p:dataTable>

Exactly as demonstrated on their showcase site .换句话说,你的陈述

althought i copied the same example shown in showcase



事实并非如此。

关于ajax - <p :ajax> Unable to attach <p:ajax> to non-ClientBehaviorHolder parent,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19955543/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com