开发者

Is there a tutorial that explains how to add / edit/ del events dynamically to fullcalendar [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the 开发者_如何学Cquestion so it can be answered with facts and citations.

Closed 1 year ago.

Improve this question

I would like to be able to add my events to my mysql databse by clicking on the calendar day and inputting into a pop up window. I need to keep the fullcalendar interface but need to add to its functionality. I have been searching extensivly for this but I keep getting side tracked or going down blind alleys. A step by step tutorial would be greatly appreciated.

I am coding in PHP with MySQL database.


Adding events isn't part of the full calender API, but it's not necessary anyway.

Just create a form that adds a new record to the database. The next time you make the call to the DB to get all the events for the calendar, your new event will show up. If you want to do this via AJAX, then each event has an eventClick function that you can hook into.


I have not found a tutorial for this but after some digging around, this seems to be the expected process:

  1. Create the JavaScript functions necessary to display a Create Event form and post the data back to the server.
  2. Hook up the dayClick event to display your Create Event form. The dayClick event will give you what you need to prefill the date/time on your Create Event form. http://arshaw.com/fullcalendar/docs/mouse/dayClick/
  3. After you send your new event to the server you have a couple of options. You can either refresh all the events data from the server with rerenderEvents or manually add your new event to the current events in memory with renderEvent (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/)

I'm getting ready to work on this tonight. If I hit any gotcha's I'll make sure to update my post.


For the newcomers, there are simple examples of adding events in the example projects repo.

For example, the react demo shows how you can dynamically create and delete events. It only shows an in-memory version, but has comments that recommend where you'd hook into your DB

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜