pbauerochse / searchable-option-list

a jquery plugin for a searchable optionlist
MIT License
79 stars 54 forks source link

Make popup always visible. #31

Open geneGK opened 8 years ago

geneGK commented 8 years ago

Is there a way to make a popup always shown without onclick command? There's a size attribute that gets overwritten for select tag. Is there a way the popup can then just stay on without hiding it.?

pbauerochse commented 8 years ago

Hi @geneGK ,

right now there is no such option. I actually never considered this use-case. The popup window is placed with a position: fixed so it hovers above any content below it. I would have to change this behaviour as well then: When all SOL popup windows are always open, any content around SOL must be placed vertically after the popup contents height.

It is possible to implement that but I'm not sure if it's worth the trouble. What's the reason, that you want to keep the window open at all times?

Cheers

geneGK commented 8 years ago

I was thinking more of a case like this below and was wondering if there was a property just like maxHeight that I can set.

<select size="6"> <optgroup label="Swedish Cars"> <option value="volvo">Volvo</option> <option value="saab">Saab</option> </optgroup> <optgroup label="German Cars"> <option value="mercedes">Mercedes</option> <option value="bmw">Audi</option> </optgroup> </select>

pbauerochse commented 8 years ago

Yes you can set a maxHeight property like this:

$('#mySelect').searchableOptionList({
    maxHeight: '60px'
});

but this only applies to the height of the popup container once it is opened. It does not show the maxHeight right from the beginning. If you don't set this value the popup will get as long as it needs to be but if you set this property you will see a scrollbar appear if the list gets too long.

Having it always open with the maxHeight is still problematic due to the position:fixed positioning of the popup. I would have to change the layouting in that special case. I might have a look at it but right now I don't think I will find time for it.

If you don't want to wait and know your way around JavaScript you may program it in there yourself and file a pull-request.

Cheers

Patrick