-
1. Re: RF4 <rich:autocomplete> - How to make the button send the ajax request?
vace117 Aug 12, 2011 8:36 PM (in response to vace117)It looks like the reason this doesn't work is b/c AutocompleteRenderer.getMinCharsOrDefault() forces minChars to 1, if it's less than one. This effectively prevents us from being able to see the whole, unfiltered list by pressing the drop-down button, which I think is a useless limitation. So, here is the fix:
{code}
/**
* Allows rich:autocomplete to specify 'minChars="0"'. This is useful if you want to be able to
* press the drop-down button ('showButton="true") and have the drop down display
* the whole, unfiltered list.
*
* @author Val Blant
*/
public class ZeroCharsFixAutocompleteRenderer extends AutocompleteRenderer {
@Override
protected int getMinCharsOrDefault(UIComponent component) {
int value = 0;
if (component instanceof AbstractAutocomplete) {
value = ((AbstractAutocomplete) component).getMinChars();
if (value < 0) {
value = 0;
}
}
return value;
}
}
{code}
And in faces-config.xml:
{code}
<renderer>
<component-family>javax.faces.Input</component-family>
<renderer-type>org.richfaces.AutocompleteRenderer</renderer-type>
<renderer-class>ca.gc.agr.agrishare.web.jsf.components.ZeroCharsFixAutocompleteRenderer</renderer-class>
</renderer>
{code}