开发者

f:param or f:attribute support on primefaces autocomplete?

I've read that the core JSF components support the f:param and f:attribute tag, in order to pass some values to the serverside for the enclosing UI Components.

There's a need for me to be able to do this for primefaces' autocomplete component, so that the autocomplete method will be able to make use of the parameter supplied by the f:param or f:attribute. I tried finding out ways to accomplish this, and found out that the complete method parameter is fixed and cannot take more arguments, hence im thinking of using f:param or f:attribute.

Im use the 2.2.x version, and based on m开发者_运维知识库y experiment, i cant seem to get the f:param or the f:attribute working

<p:autocomplete ...>
   <f:param name="myParam" value="xxxx" />
</p:autocomplete>

Is primefaces going to support this feature on the autocomplete component ? Is there anyway i can find out which tags that support the parameters and those who dont ?

Thank you !


Finally i got it working !

Here's the jsf part :

<p:autoComplete id="#{cc.attrs.id}" label="#{cc.attrs.label}"
    ....
    completeMethod="#{filterableRaceAutocompleteBean.filterRace}">

    <f:attribute name="filter" value="#{cc.attrs.filter}" />

</p:autoComplete>

And here is the source :

public List<Dto> filterRace(String filterString) {
    String filterValue = (String) UIComponent.getCurrentComponent(FacesContext.getCurrentInstance()).getAttributes().get("filter");
    log.debug("filter string : " + filterString + ", with query filter of : " + filterValue);

    ....

    return result;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜