Determine which day event is on when event is selected in fullcalendar - fullcalendar

When an event is clicked, is there any way to determine which date this event falls on? Im running into this issue when dealing with events that span multiple days, and since the event only contains a start and end date, I have not found any way to ascertain which date of the multi-day event was selected.

You can pass additional fields into your JSON object when you bind up your events.
For example, I pass in a "leave" parameter that tells me whether an event is an appointment or a part of the day off.

Related

Can event value be a dimension?

I think I saw before below Event Category, Event Action and Event Label, there was Event Value. Now there is no. Can this be the case?
My events have category, action, label and value that is integer.
No. The event value is an integer. Generally when you can do mathematical operations on a data field (event values add up) it is a metric rather than a dimension. If you try to send a string as event value you'll see an error in the GA debugger and most likely your event tracking will fail.
Event value is in fact supposed to be a currency (which does not quite work out, since it does not accept decimal numbers). The idea is to express the value of events that are not transactions as monetary value.
You could store a (stringified) version of the event value in a custom dimension. It would not by default appear in standard reports, you'd have to select it as secondary dimension or use is as a custom report. Also the values would no longer be added up.

Using dates from database column with calendar control

I'm trying to work with the ASP calendar control and (for starters) highlight the specific days on the calendar that matches DueDate in the 'task' table. I know how to highlight a cell using the DayRender event, but how do I do this in accordance to the database table?
Would then also like to be able to click on the highlighted cell and see details of the task associated to that date in some sort of box next to the calendar.
Any pointers on how I can solve this?
Pseudo-code:
Determine your desired date range (probably a certain month)
Read all the tasks that have due dates within that date range (probably need Name and DueDate at least)
In your DayRender handler you check if current day's date exists in the loaded tasks's due dates, if it does, highlight it with the color of your choice
In you SelectionChanged handler you obtain the selected day's date, and look through the loaded list of tasks for any tasks that have that date as their due date, and populate whatever box with those tasks.

Show only Months with Events In them?

Would there be a way to limit the next/prev buttons to only show months with events registered in them? We have courses that fill up and I don't want users to have to fast forward through blank months where there is no availability of events. I'm also including holiday events from the basic google public holidays calendar and don't want to include those events.
As long as I know, this option does not exist in FullCalendar yet.
If you are retrieving events month by month:
You can bind fullcalendar's Next and Previous events to a new function. Inside this function, get the events and if there is no events, your function must call Next or Previous again.
If you are retrieving all events at once
You can bind fullcalendar's Next and Previous events to a new function. Inside this function, get all the events and look for the first date out of the current month. Set fullcalendar's current date for that month and refresh it.

Already save has_many relation in getCMSField_forpopup records in appearing again in every new records in SilverStripe

I have one getCMSField_forpopup form for an event. I made another popup inside that to give multiple dates to that event(using has_many relation). When I give date 2 different dates/times to event "A" and then after saving event "A", I open main getCMSField_forpopup to enter details of another event "B" then I see dates/times (complextablefield) already there which were actually meant to appear in event A's detail not in event "B". I want to see those only with A not with every new event. How can I make that possible ?
Your problem is that you enter Dates for 1 Event, but then you can see this Dates on every single Event?
to me this sounds like either your Event has no ID at this time and therefore a query on Dates "WHERE EventID = x" does not work, or your Dates get saved without the ID of the Event
You could simply check your database if your Dates have the ID of an Event set.
If the ID if the Event is 0, then the issue is that you are not saving the event ID, this either means that:
you have created the Dates before saving the Event, in this case the solution is just saving the Event before you add Dates, you could also hide the Dates field when it has not been saved, see below the $this->isNew() stuff
or silverstripe fails to save the EventID, in this case you could fix it by adding a hidden field to your getCMSFields_forPopup of the Date and save the Event ID there, but its gonna be a little tricky getting this ID into the popup
if this is not the issue, then the problem is that when you create a new Event it has no ID, and therefore can not filter by ID, you can simply do this inside your getCMSFields_forPopup of the Event:
if (!$this->isNew()) {
// add your ComplexTableField for Dates here so it only
// gets added if this record has already been saved
}
But actually I would recommend using nested DataObjectManager (a DataObjectManager inside a DataObjectManager)(see tutorial on youtube: http://youtu.be/eeXOTlXFmQQ), DataObjectManager does all that work for you, so this problem should not occur.
It only displays the DataObjectManager for Dates if you have already saved the Event once, otherwise it tells the user that he needs to save it first.
And it also sets the Event ID on the Dates for you
Or, even better, you could upgrade to SilverStripe 3, where you can use GridField.
GridField works way better then DataObjectManager and looks a lot nicer.

How to display the calendar according to event data startdate

I have a event data which contains startdate and end date , i want to see the calendar holding that event,now what is happening is it is showing the current week calendar ,but if my event having previous week satrtdate means i have to go to previous week and and i can able to see the event data in calendar..but i want to focus that date calendar at first shot itself..pls do the needful its urgent, i think i have to change something in fullcalendar.js but i dont know where to change pls do needful
Check the documentation for FullCalendar... http://arshaw.com/fullcalendar/docs/current_date/
This shows parameters that can be set to get the calendar to initate at a particular date.. by default it will always start at todays date.

Resources