Hi All,
I am using richfaces suggestionbox. Since the number of items retrieved will depend on the first character typed, i wanted to change the height of the suggestion box (which has a initial value of 150) according to the no of items retrieved.
I have the following code in the JSF page:
<rich:suggestionbox id="taSuggestBox" for="taSuggest" style ="font-size:12px" tokens="" frequency="0" selfRendered="true" ignoreDupResponses="true" rules="#{uiQuickSearchListPopulator.rules}" suggestionAction="#{uiQuickSearchListPopulator.autocompleteTA}" var="result" fetchValue="#{result.taName}" rows="#{uiQuickSearchListPopulator.intRows}" first="#{uiQuickSearchListPopulator.intFirst}" minChars="#{uiQuickSearchListPopulator.minchars}" shadowOpacity="#{uiQuickSearchListPopulator.shadowOpacity}" border="#{uiQuickSearchListPopulator.border}" width="#{uiQuickSearchListPopulator.width}" height="#{uiQuickSearchListPopulator.height}" shadowDepth="#{uiQuickSearchListPopulator.shadowDepth}" cellpadding="#{uiQuickSearchListPopulator.cellpadding}" > <h:column> <h:outputText value="#{result.taName}" /> </h:column> <a4j:support event="onselect" action="#{uiQuickSearchListPopulator.getLMFMADCountTA}" reRender="tooltipTA,taLMFCount,taMADCount,quickSearchName,quickTotLMFCount,quickTotMADCount"></a4j:support> </rich:suggestionbox>
//Set the height of the component to match the no of records fetched. int taListSize = taList.size(); if (taListSize < 8) { this.height = new Integer(20*taListSize).toString(); }