Details
-
New Feature
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.1.7-SNAPSHOT
-
None
-
None
Description
It is very handy to allow users to type any text. If the value is then not selected from the sugggestList it would be nice to be able to use the raw entered value. this can be done by adding setRawValueMethod to the parameters in the JSf or Facelets file.
I am using this:
==================
<s:inputSuggestAjax
suggestedItemsMethod="#
"
maxSuggestedItems="50"
binding="#
"
rawValueMethod="#
"
itemLabelMethod="#
"
charset="utf-8"
id="tabClientsInvoices_SelectedProductId"
forceId="true"
autoComplete="false"
styleClass="searchfield"
style=""
disabled="#
"
converter="ProductSearchConverter"
/>
==================
I changed InputSuggestAjaxRenderer.java to contain the following method:
==================
/**
- Memorize raw input value, for later use through tag binding
*/
//@Override
public Collection getSuggestedItems(FacesContext context, UIComponent uiComponent) {
String rawValue = (String) AjaxDecodePhaseListener.getValueForComponent(context, uiComponent);
LOGGER.debug("getSuggestedItems - rawValue: "+rawValue);
MethodBinding mb = ((InputSuggestAjax) uiComponent).getRawValueMethod();
if(mb != null) {
mb.invoke(context, new Object[]
);
}
return super.getSuggestedItems(context, uiComponent);
}
}
==================
And obviosly
InputSuggestAjax.java to contain the getter and setter for this parameter:
==================
public MethodBinding getRawValueMethod()
public void setRawValueMethod(MethodBinding valueMethod)
{ _rawValueMethod = valueMethod; }==================
MAG,
Milo