Oracle ADF Jdev Ver: 11.1.1.4
My requirement is to create an input field where i can provide auto suggest and user can enter multiple email ids. It is similar to current "To" field while composing a mail in Gmail.
Problem: I have implemented input box with auto suggest. For the first entry it works fine. when i enter 2nd value(i have used ',' (comma) as separator and handled it in 'suggestItems' bean method to take sub-string after comma for providing the suggestion) , after selection.... the first value get lost. So at a time only one value is selected in the input text.
Input text:
<af:inputText label="Names" id="it21" rows="2"
columns="50" simple="true"
valueChangeListener="#{VisitBackingBean.visitMembersInputBoxCL}"
binding="#{VisitBackingBean.visitMembersInputBox}">
<af:autoSuggestBehavior suggestItems="#{VisitBackingBean.onSuggest}"/>
</af:inputText>
Bean Method:
public List onSuggest(FacesContext facesContext,
AutoSuggestUIHints autoSuggestUIHints) {
BindingContext bctx = BindingContext.getCurrent();
BindingContainer bindings = bctx.getCurrentBindingsEntry();
String inputNamevalue = autoSuggestUIHints.getSubmittedValue().trim();
if(inputNamevalue.contains(",")) {
inputNamevalue = inputNamevalue.substring(inputNamevalue.lastIndexOf(",")+1).trim();
}
//create suggestion list
List<SelectItem> items = new ArrayList<SelectItem>();
// if (autoSuggestUIHints.getSubmittedValue().length() > 3) {
// }
OperationBinding setVariable =
(OperationBinding)bindings.get("setnameSearch");
setVariable.getParamsMap().put("value",
inputNamevalue);
setVariable.execute();
//the data in the suggest list is queried by a tree binding.
JUCtrlHierBinding hierBinding =
(JUCtrlHierBinding)bindings.get("AutoSuggestName_TUserROView1");
//re-query the list based on the new bind variable values
hierBinding.executeQuery();
//The rangeSet, the list of queries entries, is of type //JUCtrlValueBndingRef.
List<JUCtrlValueBindingRef> displayDataList =
hierBinding.getRangeSet();
for (JUCtrlValueBindingRef displayData : displayDataList) {
Row rw = displayData.getRow();
//populate the SelectItem list
items.add(new SelectItem(rw.getAttribute("UsrUserName").toString().trim() +
"<"UsrMailId").toString().trim() +
">",
rw.getAttribute("UsrUserName").toString().trim() +
"<" +
rw.getAttribute("UsrMailId").toString().trim() +
">"));
}
return items;
}
Please suggest how can i achieve the mentioned functionality.