Welcome Guest, Not a member yet? Register   Sign In
Changing the background color of calendar cell using dynamic data
#1

[eluser]katimari[/eluser]
Hi everyone,
I'm having a bit of trouble figuring out how to target a specific cell in a calendar using CI's calendar class. Basically, I have data saying whether a date should show up as pink or green. I also want anything before today's date to show up as grey. I have data this at the time when I generate the calendar.

Can anyone help me understand how I could change the class of a table cell based on data and date?

Thanks in advance!
#2

[eluser]CroNiX[/eluser]
I haven't used the calendar class, but from the docs it looks like you would have to create a custom template, although to tell you the truth I think something like that would be easier to do custom. It looks like you would have to loop through your data to create the $prefs['template'] string and then pass that to the calendar object along with the original data to parse. Basically have your code assign certain classnames to the <td> cells the way you want and then style them with css.




Theme © iAndrew 2016 - Forum software by © MyBB