私はRailsとFullCalendar Schedulerで作業しています。新しいものを追加するときに私がリソースとして与えるJSONオブジェクトを更新したいと考えています。ここでFullCalendarスケジューラーの更新リソースJSONオブジェクト
は私のカレンダーのオプションの簡易版である:
fullcalendar-settings.js
$(document).ready(function() {
$('#calendar').fullCalendar({
header: {
left: 'promptResource, prev, next, today',
center: 'title',
right: 'agendaWeek, timelineDay'
},
customButtons: {
promptResource: {
text: '+ maker',
click: function() {
var name = prompt('Name');
if (name) {
$('#calendar').fullCalendar(
'addResource', { title: name }, true // scroll to the new source?
);
}
}
}
},
defaultView: 'timelineDay',
defaultDate: moment(),
editable: true,
resourceColumns: [
{
labelText: 'Client',
field: 'title'
}
],
resources: 'scheduler.json',
events: []
});
});
scheduler.json
[
{ "id": "1", "title": "LE" },
{ "id": "2", "title": "DB" },
{ "id": "3", "title": "VB" },
{ "id": "7", "title": "RL" }
]
リソースは、スケジューラ「からロードされています.json 'と私はあなたが新しいリソースを追加することができますボタンがありますが、それはfoですrは一時的にしかリロード時に消えません。
私は新しいリソースを追加するときに 'scheduler.json'内のJSONオブジェクトをどのように更新できますか?
ありがとうございます。
カレンダーでイベントを作成した後、次回にページをリロードするときにscheduler.jsonファイルを生成するデータベースを更新するために、ajaxリクエストを送信する必要があります。 –
私はJSONで大丈夫ですが、この種の要求をどうやって行うかはわかりません。 – LRP