user1433804 user1433804 - 1 month ago 19
Java Question

PrimeFaces AutoComplete changing default size

I am trying to change the size of the autoComplete (primefaces 3.3), I tried all the below options but the size remains the same.

size="600"
Style="width:600px;"
StyleClass > css file with width:600px;


but none of them increases the size, so how do i do it.

Note: I noticed that if I specify (width > PanelGrid size) then the panel grid size changes automatically but autoComplete is still in default size.

Update:
my autoComplete code

<p:autoComplete id="autoTest" value="#{testMB.selectedTest}"
completeMethod="#{testMB.completeTest}" var="test"
itemLabel="#{test.name}" itemValue="#{test}" converter="#{testConverter}"
forceSelection="TRUE" queryDelay="1000" multiple="TRUE" size="600"
process="@this">

Answer Source

I did it using the below css

.ui-autocomp .ui-inputfield {
clear: left;
cursor: text;
list-style-type: none;
margin: 0;
min-height: 1px;
overflow: hidden;
width: 250px;
}

Just need to make sure that the selection doesn't exceed 250px, otherwise the close icon + extra text will not be visible.

Note: i got this from primeface css file