How to add the Background-color to the Schedule Date Selected

background-color, css, jsf, primefaces

Solution

The style class you are looking for is

ui-state-highlight

The Primefaces documentation explains how to change the style for a particular component:

In your facelet:

<p:schedule styleClass="custom">
...
</p:schedule>

And in your css:

.custom .ui-state-highlight {
    background: yellow !important;
}

UPDATE 1:

Here is a complete working example:

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html" 
      xmlns:f="http://java.sun.com/jsf/core"     
      xmlns:p="http://primefaces.org/ui">
    <h:head>
        <title>Facelet Title</title>
        <style type="text/css">
            .custom .ui-state-highlight {
                background: yellow !important;
            }
        </style>
    </h:head>
    <h:body>
        <p:schedule styleClass="custom">
        </p:schedule>
    </h:body>
</html>

UPDATE 2:

Well, basically a primefaces schedule day is a table cell like this:

<td class="fc-fri ui-widget-content fc-day19">
  <div>
    <div class="fc-day-number">18</div>
    <div class="fc-day-content">
      <div style="position:relative">&nbsp;</div>
    </div>
  </div>
</td>

Notice that there is a special style class `fc-day19` for the table cell with content `18`.

The following jQuery command changes the background-color of this cell based on this special class:

$(".fc-day19").css("backgroundColor","green");

This is not the complete solution of your problem but this is how it could work. You need to identify the table cell of your desired date and change its style accordingly (note that the css `background-color` needs to be camel-cased to `backgroundColor` if it is used in jQuery. Hope this helps.

Problem

How to add the Background-color to the Selected Date in the Schedule Tag in the Primefaces ? I have already used style but it going for the Schedule Background color. i want to get the Background -color to my selected Date inside the Schedule .So if u guys have any ideas please share it..

Original source