Calendar_Action[Permalink]Calendar ActionXataface 1.0 includes a built-in calendar action that is disabled by default. If enabled, it allows you to view the records in any found set as a calendar of events, as follows:
Features
RequirementsYour table records should contain at least dates in order for them to be interpreted as events that can be placed in a calendar. Setting up the CalendarSuppose I have a table called Lessons that stores information about scheduled music lessons. If I want to add the calendar to this table, then I would add an actions.ini file to the tables/Lessons directory with the following contents:
This overrides the calendar action which is disabled by default, and enables it for the Lessons table.
Next I need to inform Xataface which fields store the event dates and times so that the records can be laid out in the calendar appropriately. (Note that if you skip this step, Xataface will make a best guess based on column types and names - but it is better to specify these explicitly). In the Lessons table I have the following fields that are relevant here:
We can tell Xataface to treat these fields accordingly by adding the following directives to the appropriate field sections of the fields.ini file for the Lessons table:
So in our case we'll modify the fields.ini file as follows:
Now if we load up our application, we should now see a calendar tab along side list, details, and find for the Lessons table. Click on this tab to see your records displayed in a calendar. Using a datetime field to store both date and start timeYou can also use a single field to store both the date and start time for an event. In this case you just provide the event.date and event.start directives for the same field. For example if the lesson_date was a datetime field that marked the date and time of the lesson, we would modify our fields.ini? file as follows:
Available FieldsThe Calendar action will look for the following pieces of information in your records:
|