我有一個複合組件,它是PrimeFaces自動完成的專業化組件。JSF 2複合組件+ clientBehavior
在一些網頁我需要使用itemSelect事件,所以我在組件接口添加
<cc:clientBehavior name="itemSelect" event="itemSelect"
targets="#{cc.attrs.id}" />
,但動作不會被解僱。
我錯過了什麼?
組件代碼:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:cc="http://java.sun.com/jsf/composite"
xmlns:p="http://primefaces.org/ui" >
<!-- INTERFACE -->
<cc:interface>
<cc:attribute name="value" required="true" />
<cc:attribute name="disabled" default="false" />
<cc:attribute name="required" default="false" />
<cc:attribute name="size" default="25" />
<cc:clientBehavior name="itemSelect" event="itemSelect"
targets="#{cc.attrs.id}" />
</cc:interface>
<!-- IMPLEMENTATION -->
<cc:implementation>
<p:autoComplete disabled="#{cc.attrs.disabled}"
value="#{cc.attrs.value}"
completeMethod="#{tecnicoBean.completarViajante}" var="t"
itemLabel="#{t.nome}" itemValue="#{t}" minQueryLength="2"
forceSelection="true" converter="entityConverter"
size="#{cc.attrs.size}" queryDelay="700" label="Técnico:"
onclick="this.select()" cache="true">
</p:autoComplete>
</cc:implementation>
</html>
部件使用情況:
<ezcomp:tecnicos value="#{sessionScope.tecnicoRdv}">
<p:ajax event="itemSelect" process="@this" update=":mainPanel"
listener="#{rdvBean.changeTecnico}" />
</ezcomp:tecnicos>
請點擊這裏發佈您的代碼之前格式化'代碼indentation' – SRy