开发者

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

开发者 https://www.devze.com 2023-03-16 21:41 出处:网络
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.

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

精彩评论

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

关注公众号