Calendar

Q:
I need to filter the data for the calendar section based on a public variable. I cannot find a similar “Where Condition” attribute for the calendar section?
A:
Filter

Screen Shot 2015-01-25 at 10.18.32 AM


Q:
Is there a variable or attribute that stores the current month and year displayed in calendar section

A:
When you specify a “Click delegate” for the calendar section in the attributes, when the user clicks on an event or clicks on a calendar cell the click delegate is called with a JSON encoded string as an argument.
In your case, as you are building a desktop App you can use json_decode() to decode the argument into an object.
This object then has members:
start_date
end_date
start_time
end_time
You can look at the object using json_decode( arg )
Example desktop calendar click delegate:
proc myCalendarClickDelegate( arg )
? json_decode(arg)
endproc


Q:
I notice under the calendar options the following attributes
a) Click Delegate
b) Dynamic day backcolor
c) Dynamic event backcolor
d) Dynamic event forecolor
In my case, my table has a field that indicate the type of shift and I want to color the days in a month based on the shift type

A:

As the calendar is being rendered, for each record the “delegate” functions for the dynamic coloring are called. When they are called the active record is in the currently selected cursor.

You can therefore just inspect the fields in the record (or lookup some other data in another table) and return a color code. This color code is a string and can be any of the standard web colors e.g. “pink”, “lightgreen” etc or it can be a HTML/CSS style color code e.g. “#cfcfcf”.
The delegate settings are in the attributes. See below.

Screen Shot 2014-12-27 at 3.46.25 PM

If you read the source code of calendar_view.rsp in the library directory you will see how this is achieved.
Also notice in the screenshot that “Event Type choices” determine what appears in the drop down list and also the color that corresponds to that type of event.


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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s