简体   繁体   English

月和周视图中的全日历自定义标题

[英]Fullcalendar custom header in Month and week view

Fullcalendar.io has the Option to make custom ColumnHeaders in Html. Fullcalendar.io 可以选择在 Html 中制作自定义ColumnHeaders。

How can I make a difference between my month and my week view?如何区分我的月视图和周视图? For the month view i will only display the weekday in the header.对于月视图,我只会在标题中显示工作日。

 columnHeaderHtml: function (date) {
      const days = ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'];
      let html = '';
      html += '<span class="column-header-week">' + days[date.getDay()] + '</span>';
      html += '<span class="column-header-day">' + date.getDate() + '</span>';
      return html;
}

在此处输入图片说明

Solution from ADyson works like a charm: fullcalendar.io/docs/view-specific-options ADyson 的解决方案就像一个魅力: fullcalendar.io/docs/view-specific-options

views: {
   dayGrid: {//week and day view
     columnHeaderHtml: function (date) {
          const days = ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'];//todo asptext
          let html = '';
          html += '<span class="column-header-week">' + days[date.getDay()] + '</span>';
          return html;
       }
    },
    timeGrid: { //month view         
      columnHeaderHtml: function (date) {
         const days = ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'];//todo asptext
         let html = '';
         html += '<span class="column-header-week">' + days[date.getDay()] + '</span>';
         html += '<span class="column-header-day">' + date.getDate() + '</span>';
         return html;
     }
 },

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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