0

イベントが表示されている JQuery イベント カレンダーがあります。イベントの背景色を変更し、恒久的な色変更の値を挿入するクリック機能が必要です。また、変更された色のイベント カレンダーを実行するコードも必要です。これは私のイベントカレンダーコードです...

$(document).ready(function () {

    $('#Uploaded').hide();

    $('#chang').click(function () {
        $('#Uploaded').show('slow');
    });

    $('#chang2').click(function () {
        $('#Uploaded').show('slow');
    });

    $('.fc-event-skin').live("click", function () {
        $(this).css('background-color', '#090');
        $(this).css('border-color', '#090');
    });

    $('#calendar').fullCalendar({

        editable: true,
        eventColor: '#cd3427',    
        events: "json-events.php",    
        buttonText: {
            today: 'idag'
        },
        monthNames: ['Januari', 'Februari', 'Mars', 'April', 'Maj', 'Juni', 'Juli',
                     'Augusti', 'September', 'Oktober', 'November', 'December'],    
        dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday',
                   'Thursday', 'Friday', 'Saturday'],

        eventDrop: function (event, delta) {

            $.ajax({
                type: "POST",
                url: "drag.php",
                data: "date=" + delta + "&id=" + event.id,
                success: function (msg) {
                    //alert( "Data Saved: " + "id="+ event.id +"&date="+ delta );
                }
            });

        },

        loading: function (bool) {
            if (bool) $('#loading').show();
            else $('#loading').hide();
        }

    });

});
4

1 に答える 1

0

APIをまったく読んだことがありますか?

http://arshaw.com/fullcalendar/docs/event_data/Event_Source_Object/#options

イベント生成関数を使用してそれを行う方法は次のとおりです。

......
events: function (start, end, callback) {
    $.ajax({
        url: url,
        data: "json-events.php",
        success: function (data) {
            console.log(data);
            //console.log is to see what you are receiving from server actually (event text,color,id....whaever you send), use google chrome, press F12 to open console
            //here you do whatever you want with your data fetched from server if any modification required
            //just make it look like this finally
            //[event0,event1,event2,.....]
            //Where your event array elements are javascript objects
            //finally give the array to the calendar:

            //callback([event0,event1,event2,.....])
        },
        dataType: /* xml, json, script, or html */
    });
},
....

配列内の各イベント オブジェクトはどのように見えるでしょうか? http://arshaw.com/fullcalendar/docs/event_data/Event_Object/ イベントのプロパティは、私が上に投稿したページにありますが、いずれにせよ、オプションおよび必須のプロパティを持つ JavaScript オブジェクトです! すべてをリストして例を挙げています!自分の場合に役立つものを自分で決定します。

{
    id: "id value", 
    end: "end date", //when event ends - required field
    start: "start date", // when event starts - required field
    title: "title value",
    textColor: "color value",
    className: "add your style Class",
    backgroundColor: "color value",
    borderColor: "color value",
    editable: "boolean value"
}
于 2013-01-18T14:44:08.143 に答える