help with r:suggestionbox
tuxzilla Jun 25, 2007 11:25 PMI virtually copied the suggestionbox example code in demo to my app but the suggestion box didn't show up. The inputText field was fine but when I typed in something nothing showed up. I used debugging and confirmed that suggestionBox.autocompletion method was not invoked. I am using richfaces 3.0.1. Here is the view code (inside an xhtml file):
<h:form> ... <h:panelGroup rendered="#{businessHome.definedInstance == null}"> <h:inputText id="businessTitle" required="true" size="36" maxlength="128" value="#{suggestionBox.property}"/> <rich:suggestionbox id="suggestionBoxId" for="businessTitle" tokens=",[" rules="#{suggestionBox.rules}" suggestionAction="#{suggestionBox.autocomplete}" var="result" fetchValue="#{result.title}" rows="#{suggestionBox.intRows}" first="#{suggestionBox.intFirst}" minChars="#{suggestionBox.minchars}" shadowOpacity="#{suggestionBox.shadowOpacity}" border="#{suggestionBox.border}" width="#{suggestionBox.width}" height="#{suggestionBox.height}" shadowDepth="#{suggestionBox.shadowDepth}" cellpadding="#{suggestionBox.cellpadding}"> <h:column> <h:outputText value="#{result.title}"/> </h:column> </rich:suggestionbox> </h:panelGroup> ... </h:form>
Here is the java bean suggestionBox:
import java.io.Serializable; import java.util.List; import java.util.ArrayList; import org.richfaces.renderkit.html.SuggestionBoxRenderer; import org.jboss.seam.annotations.Name; /** * Created by IntelliJ IDEA. * To change this template use File | Settings | File Templates. */ @Name("suggestionBox") public class SuggestionBox implements Serializable { /** * */ private String property; private ArrayList data; private ArrayList tokens; private String rows; private String first; private String cellspacing; private String cellpadding; private String minchars; private String frequency; private String rules; private boolean check; private String shadowDepth = Integer.toString(SuggestionBoxRenderer.SHADOW_DEPTH); private String border = "1"; private String width = "300"; private String height = "200"; private String shadowOpacity = "4"; private AllowSuggestion allowSuggestion; public SuggestionBox() { this.rows = "0"; this.first = "0"; this.cellspacing = "2"; this.cellpadding = "2"; this.minchars = "1"; this.frequency = "0"; this.rules = "none"; } public List autocomplete(Object suggest) { return allowSuggestion.autocomplete(suggest); } public ArrayList getData() { return data; } public void setData(ArrayList data) { this.data = data; } public String getProperty() { return property; } public void setProperty(String property) { this.property = property; } public String getCellpadding() { return cellpadding; } public void setCellpadding(String cellpadding) { this.cellpadding = cellpadding; } public String getCellspacing() { return cellspacing; } public void setCellspacing(String cellspacing) { this.cellspacing = cellspacing; } public boolean isCheck() { return check; } public void setCheck(boolean check) { this.check = check; } public String getFirst() { return first; } public int getIntFirst() { return Integer.parseInt(getFirst()); } public void setFirst(String first) { this.first = first; } public String getFrequency() { return frequency; } public double getDoubleFrequency() { return Double.parseDouble(getFrequency()); } public void setFrequency(String frequency) { this.frequency = frequency; } public String getMinchars() { return minchars; } public void setMinchars(String minchars) { this.minchars = minchars; } public String getRows() { return rows; } public int getIntRows() { return Integer.parseInt(getRows()); } public void setRows(String rows) { this.rows = rows; } public String getRules() { return rules; } public void setRules(String rules) { this.rules = rules; } public ArrayList getTokens() { return tokens; } public void setTokens(ArrayList tokens) { this.tokens = tokens; } public void OnSelect() { System.out.print("Onselect works!!!"); } public String getShadowDepth() { return shadowDepth; } public void setShadowDepth(String shadowDepth) { this.shadowDepth = shadowDepth; } public String getBorder() { return border; } public void setBorder(String border) { this.border = border; } public String getWidth() { return width; } public void setWidth(String width) { this.width = width; } public String getHeight() { return height; } public void setHeight(String height) { this.height = height; } public String getShadowOpacity() { return shadowOpacity; } public void setShadowOpacity(String shadowOpacity) { this.shadowOpacity = shadowOpacity; } public void setAllowSuggestion(AllowSuggestion allowSuggestion) { this.allowSuggestion = allowSuggestion; } }
Any help? Thanks.