简体   繁体   中英

Full Calendar creating simple event

I am new to using FullCalendar, and I am planning on using JSON to feed it the events but i dont know how to start. I am trying to hard code an event into it just to have an idea of where and how i should be passing it the JSON. Most likely i will create a webservice that has a function that returs the Json format and feed it, but in the meantime. How can i hard code an event. Here is the code I currently have. How and where can I hard code an event below? :

<script type="text/javascript">
    $(document).ready(function () {

        $('#calendar').fullCalendar({
            allDaySlot: false,
            header: {

                left: 'today prev next',
                center: 'title',
                right: 'month,agendaWeek,agendaDay'
            },
            axisFormat: 'h(:mm)tt',
            timeFormat: { agenda: 'HH:mm{ - HH:mm}' },
            defaultView: 'month',
            editable: false,
            minTime: '8:30am',
            maxTime: '10:00pm',
            weekends: true,
            eventRender: function (event, element) {
            },
            eventClick: function (calEvent, jsEvent, view) {
            },
            dayClick: function (date, jsEvent, calEvent) {
            }

        })
    });

Please see: http://arshaw.com/fullcalendar/docs/event_data/events_json_feed/ for documentation on using JSON feeds as data inputs with jQuery FullCalendar.

Demo: http://jsfiddle.net/SO_AMK/dB2Ps/

I can't actually create a hosted JSON file, but you should be able to feed it the raw JSON output (I have a sample in my demo).

And a more complex one using every available field, you can insert as many non-standard fields as you want: http://jsfiddle.net/SO_AMK/u8Ksw/

Very easy to find the various source implementations in the API:

Here's link to Events(JSON feed) docs. http://arshaw.com/fullcalendar/docs/event_data/events_json_feed/

Just provide your url. There is another set of docs if you already have the object in DOM rather than having plugin make an ajax request

Also , if I remember correctly the download package also contains examples.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM