記事詳細


投稿日
2025年09月12日17時44分
タイトル

FullCalendar

内容

    var calendar = new FullCalendar.Calendar(calendarEl, {

        initialView: 'dayGridMonth', // Default view

        customButtons: {

          myCustomButton: {

            text: 'Detailsを表示',

            click: function() {

              // alert('カスタムボタンがクリックされました!');

              window.location.href = '/Events/Details?id=1001'; // 遷移先URLを指定

            }

          }

        },

        headerToolbar: {

            left: 'prev,next today  myCustomButton',

            center: 'title',

            right: 'dayGridMonth,timeGridWeek,timeGridDay'

        },

        

         events: '/Events/GetEvents', // Fetch events from the backend API

         

           eventClick: function(info) {

  // イベントのIDを取得

  var eventId = info.event.id;

  console.log('イベントID:', eventId);


  // 必要に応じて他の処理を追加

  alert('クリックしたイベントのIDは: ' + eventId);

   window.location.href = '/Events/Details?id=' + eventId;

},

添付画像

画像はありません
Genreのカテゴリ-名
MVCTutorials
編集 | 記事一覧