-
Book Overview & Buying
-
Table Of Contents
Primefaces Theme development
By :
It is not enough to create a CSS rule in order to apply skinning capabilities to an HTML element. We need to assign this CSS rule for a generated HTML element with the help of a JS function. If you look at the generated HTML for a schedule component using developer tools, then it clearly shows that each day cell in the schedule is a <td> element with a data-date attribute to store the current date.
The generated HTML for the schedule component of the first row will be as follows:

Now, let's create a JS function in the head section for the yellow background color required for the date selection. The JavaScript function is created in two ways, based on either client-side or server-side access.
The client-side access approach to set the background color for a selected date can be implemented by adding the following code snippet in the head tag of the dynamicChangesClientsidecall.xhtml page:
function setSelectedDateBackground...
Change the font size
Change margin width
Change background colour