change default background color of selected element tree

Vadim Source

Help me please change default background color of selected element in tree.

The xhtml code is

    <style type="text/css">
        .ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight
        {
            background-color: green;
        }
    </style>
    <h:head>
    </h:head>
    <h:body>
        <h:form id="mainform">
            <h:panelGrid columns="4" layout="grid">
                <p:outputPanel style="width: 100%; height: 400px">
                    <div id="mainTableDiv">
                        <p:tree id="tree1" value="#{treeDNDView.root1}" var="node" selectionMode="single"
                                selection="#{treeDNDView.selectedNode1}"
                                draggable="true" droppable="true" dragdropScope="demo" scrollable="true"
                                scrollHeight="630" widgetVar="tree1">
                            <p:treeNode>
                                <h:outputText value="#{node}"/>
                            </p:treeNode>
                        </p:tree>
                    </div>
                </p:outputPanel>
......

The result of inspection is:

firefox inspection

The color of selected items is grey, but I need a green.

cssprimefaces

Answers

answered 6 months ago Vadim #1

Added

.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight**, .ui-tree**

and

<p:tree id="tree1" value="#{treeDNDView.root1}" var="node" selectionMode="single"
                                selection="#{treeDNDView.selectedNode1}"
                                draggable="true" droppable="true" dragdropScope="demo" scrollable="true"
                                scrollHeight="630" widgetVar="tree1" **styleClass="ui-tree"**>
                            <p:treeNode>
                                <h:outputText value="#{node}"/>
                            </p:treeNode>
                        </p:tree>

And eliminate !important.

comments powered by Disqus