Calendar [examples]

Click delegate

Optional. The name of a delegate script to be called when a cell in the calendar is clicked. Data is passed to the click delegate in JSON format. e.g.

calendar_click
function calendar_click(data)
{
	// You can handle a custom calendar cell click event here
	Lianja.writeLog(data);
};
{"database":"southwind","table":"employees_calendar","columns":"eventtitle,eventstart,eventend,eventrepeat,eventallday,eventtype",
"keyvalue":"Buchanan","keyexpr":"lastname","title":"Meeting","start_date":"2015-09-08","end_date":"2015-09-08","start_time":"09:00",
"end_time":"17:00","allDay":"true","repeat":"false","rowid":"42","id":0,"action":"eventclick","sectionid":"section2",
"eventtype":"eventtype","eventtypevalue":"Sales Meeting"}

Dynamic day backcolor

Optional. The name of a function in the Custom delegate library that returns dates and their associated background colors, allowing specific dates to be highlighted. e.g.

getdatecolors

The function should accept a parameter which will have one of two values: ‘dates’ or ‘colors’.

If the parameter is ‘dates’, the function should return a string containing comma-separated ISO format character string dates. These can contain a single ‘*’ to indicate either all years, all months or all days. The strings ‘sunday’ and ‘saturday’ are also recognized.

If the parameter is ‘colors’, the function should return a string containing comma-separated color strings (e.g. ‘red’ or ‘#FF0000’), one for each date in the dates string. The colors will be applied to the dates in order. e.g.

function getdatecolors(para1)
	if para1 = "dates"
		return ['2015-*-28','sunday','&(strftime("%F",dtoc(date())))','*-09-01']
	else
		return ['purple','yellow','blue','#FF0000']
	endif
endfunc

In the example above, the 28th of every month in 2015 will have a purple background, all Sundays will have a yellow background, the current date will have a blue background and September 1st every year will have a red background.

Dynamic event backcolor

Optional. The name of a function in the Custom delegate library that returns a color string (e.g. ‘red’ or ‘#FF0000’) to be used as the background color for a specific event type. e.g.

geteventback

The event type is passed as a parameter to the function. e.g.

function geteventback(para1)
	do case
	case para1 = "UK Bank Holiday"
		return 'red'
	case para1 = "US Public Holiday"
		return 'pink'
	otherwise // all other event types
		return 'white'
	endcase
endfunc

Note that event type / color pairs can also be specified in the Event type choices as described above.

Dynamic event forecolor

Optional. The name of a function in the Custom delegate library that returns a color string (e.g. ‘red’ or ‘#FF0000’) to be used as the foreground color for a specific event type. e.g.

geteventfore

The event type is passed as a parameter to the function. e.g.

function geteventfore(para1)
	do case
	case para1 = "UK Bank Holiday"
		return 'pink'
	case para1 = "US Public Holiday"
		return 'white'
	otherwise // all other event types
		return 'black'
	endcase
endfunc

Note that event type / color pairs can also be specified in the Event type choices as described above.

https://www.lianja.com/doc/index.php/Calendar_Options


 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.