4

I am using the fullcalendar plugin for my angular application. I am using eventSource to get my events. I have title, start, end and breakCount keys in my JSON, like this:

{
    "title": "06DefaultProgram2",
    "start": "2016-02-06 13:30:00",
    "end": "2016-02-06 18:00:00",
    "breakCount": 2
}  

Full calendar takes title, start and end but I also want to display the breakCount on my event cell. How can I achieve this?

2

2 Answers 2

1

You can add a callback function for the eventRender event. Docs are at http://fullcalendar.io/docs/event_rendering/eventRender/

The eventRender Event will pass the event object and the element pre built with the unmodified html element that would normally be displayed. In the code you write for this event handler you refer to the custom property by name as event.breakCount. Within the code you write in this event handler you can either modify the element parameter to display the value of event.breakCount (Maybe concatenating it to the end of existing title text), or create and pass back an entirely new element to display the event. You have full control over presentation of the event in this handler.

-1

You can make this possible as below.

Attach your breakCount in title

{
    "title": "06DefaultProgram2<br>2", // 2 is your breakCount, you have to manage this in your server script.
    "start": "2016-02-06 13:30:00",
    "end": "2016-02-06 18:00:00",

}  
1
  • I want it as a seperate element to apply different styles. appending it to title will not make clear understanding. Feb 5, 2016 at 10:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.