Venkat Maridu
Venkat Maridu

Reputation: 902

p:selectCheckboxMenu Need Label for selecting all

Am tring to add label for check box [That is for checking all Checkboxs] p:selectCheckboxMenu as in the figure.

enter image description here

Here is the Code:

<p:selectCheckboxMenu value="#{dashBoardController.selectedColumns}" 
                          styleClass="ui-selectcheckboxmenu-header" 
                          label="Custom" filterMatchMode="startsWith"
                          panelStyle="width:220px">

    <f:selectItem itemLabel="Status" itemValue="status"/>                    
    <f:selectItem itemLabel="group name" itemValue="groupName"/>                    
</p:selectCheckboxMenu>

CSS:

.ui-selectcheckboxmenu-header:before
{
    content: "All";
}

any suggestions ??

Upvotes: 1

Views: 5323

Answers (1)

Cold
Cold

Reputation: 797

After some 5 min of CSS fights, i discover some maneer to do it (i think its not the normal way to do, but i did not find other way).

You can use the content style property to atach content to an html element from css. The p:selectCheckboxMenu header class is .ui-selectcheckboxmenu-header, so, if you try this:

// on your css file
.ui-selectcheckboxmenu-header:before
{
    content: "MY TEXT FOR SELECTING ALL ON MANY CHECKBOX MENU";
}

you will have the expected result. More info about content property, visit this link.

Note: I recommed to give an css id on the specific p:selectCheckboxMenu to have the pretended title. If you wonna for all p:selectCheckboxMenu you can use the code as it's.

Hope it helps ^^

Upvotes: 2

Related Questions