bulltorious
bulltorious

Reputation: 7897

Start a <p:selectCheckboxMenu> expanded?

I feel like this is a simple question, but all of my googling and reading has not presented an answer. That being said, I am still very new to JSF (PF).

Anyways, I am using the SelectCheckboxMenu component from PrimeFaces and want to know how I can start it "expanded" or "open" without requiring the click to open it up.

Here is how it looks normally when initially rendered:

Movies Unexpanded Image

Here is how I would like it to look when initially rendered, without using a mouseclick to expand it:

enter image description here

Upvotes: 1

Views: 2292

Answers (3)

fernandohealthchess
fernandohealthchess

Reputation: 341

you can define a widgetVar to your p:selectCheckBoxMenu and call show();

and another place, call

xisWidget.show();

Upvotes: 0

Alexandre Lavoie
Alexandre Lavoie

Reputation: 8771

A simple way that can do it :

<style>
    .start-expended.ui-selectcheckboxmenu-panel
    {
        display: block;
    }
</style>

<p:selectCheckboxMenu panelStyleClass="start-expended" label="Test">
    <f:selectItem itemLabel="test" itemValue="test" />
</p:selectCheckboxMenu>

Note the panelStyleClass attribute that is used only as a distinctive selector in case you have many components and only want to show particular ones open.

Upvotes: 2

zargarf
zargarf

Reputation: 643

You can use jquery (it's already in primefaces) on page load. You can either use the code below which will show all selectcheckbox menu panels, or you can replace the $(".ui-selectcheckboxmenu-panel") with $('#WHATEVERTHEELEMENTIDIS') - where WHATEVERTHEELEMENTIDIS is the full id of the panel within the component

<script>
$(document).ready(function(){
    $(".ui-selectcheckboxmenu-panel").show();

    });
</script>

Upvotes: 1

Related Questions