Add Event in Timeline view

How do I use the addEvent() API to add a new event in timeline mode?

I have 2 timeline view that displays 7 days and 30 days respectively and several resources/sections in the y-axis.

How would I add an event such that they are attached to a specific resource/section and appears in both the 7-day view and the 30-day view?

What I am trying to accomplish here is to add a pre-filled event to the scheduler (in timeline view) when a user clicks on a button somewhere on the page.

Please advise on how I can do it without using the lightbox. Thanks!

Sorry if I seem a little impatient but can anyone give any hints as to how to get this done? Or if it’s even possible? This seems like a pretty trival thing but I just can’t seem to figure it out. :neutral_face:

scheduler.addEvent({ start_date: new Date(2012,0,1), end_date: new Date(2012,0,5), text: "Hello world!", section_id: 5 });

Important part here is “section_id”. Event above would be displayed in section with id = 5. In your case instead of section_id you should use your timeline view “map_to” property.

Kind regards,

Thanks! I knew it was something simple!
Nearly pulled my hair out.

I tried the following based on the docs at … r_addevent

      start_date: "16-03-1984",
      end_date: "19-03-1984",
      section_id: 1,
      custom_data:"some data"

However, that didn’t work and now I know it’s because the start and end dates have to be Date objects!

Thanks again!!


They don’t have to be Date objects, they can be strings as well BUT their format should match scheduler.config.api_date format.

Kind regards,

I see. Thanks for the clarification!