Display the resourceTimeGrid in the month view using Fullcalendar's rendering feature

Hey everyone, I'm trying to divide a month into 4-5 weeks with each week having 7 days. I'm struggling to figure out how to display the entire month in this format. Currently, only the current week is shown where each column represents the days of the week. I would like to render the entire month following this structure.

 
this.calendarOptions = {
  headerToolbar: {
    left: '',
    center: 'title',
    right: 'prev next'
  },
  defaultAllDay:false,
  aspectRatio: 2.45,
  editable: false,
  slotMinWidth: 75,
  selectable: false,
  eventClassNames: ['mt-1'],
  eventResourceEditable: false,
  eventOverlap: false,
  initialView: 'resourceTimeGridSevenDay',
  resourceLabelClassNames: ['p-0'],
  resourceGroupLabelContent: (arg) => {
    return {html: `<strong>${arg.groupValue}</strong> `};
  },
  resourceLabelContent : (arg) => {
    return {html: `<span> ${arg.resource._resource.title}</span> `};
  },
  slotLabelContent: (arg) => {
    return {html: ` `};
  },

  eventClick: (arg) => {
    console.log('event click')
  },
  now: new Date().toISOString(), 
  resourceAreaHeaderContent: 'Sponsor/Protocol',
  resourceAreaWidth: '10%',
  views: {
    resourceTimeGridSevenDay: {
      type: 'resourceTimeGrid',
      duration: {days: 7},
      slotDuration: { weeks: 4 },
    }
  },
  events: 'https://fullcalendar.io/demo-events.json?with-resources=2',
  fixedWeekCount: false,
  rerenderDelay: 2,
  progressiveEventRendering: true,
  
  showNonCurrentDates: false,
  initialDate: new Date().toISOString(),

}

https://i.sstatic.net/qJqS9.png

Answer №1

Creating the exact layout shown in your screenshot using fullCalendar may not be possible, but you can achieve a similar result that could suffice.

The slotLabelFormat setting in the documentation mentions that for the timeline view, you can configure it with multiple rows in the label area.

For instance, you can use the "month" view to display the correct number of days and adjust the slot labeling like this:

views: {
  resourceTimelineMonth: {
    slotLabelFormat: [
      { week: 'long', }, // top level of text
      { weekday: 'short', day: '2-digit' } // lower level of text
    ],
  }
},

This setup displays the week number as the week of the year and provides a date format that is similar (though subject to locale variations).

Check out a live demo here: https://codepen.io/ADyson82/pen/BawNMEp

If you require more precise control over the date format, consider utilizing one of the plugins referenced in the Date Formatting documentation.

Documentation resources:

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for utilizing vulnerable web scripts on SSL-enabled pages

After implementing SSL to secure my pages, I encountered an issue where one of my scripts no longer functions properly. Specifically, I had a script on my page that was used to display the visit count from this website. Previously, it was functioning fla ...

A guide on using the patch API and Multer package to update files and images

After reviewing my code, I have successfully created a user model and imported it into the controller. Additionally, I have also imported an upload middleware from another directory where the code is written for uploading files/images using the multer pack ...

How can I retrieve a DOM object following an AJAX request?

My AJAX call fetches and appends HTML content to the current page. I hope to access this newly added HTML using standard jQuery selectors. Here's my desired approach... $.ajax({ url: url, success: function(data) { $('body').app ...

What is the best approach for iterating through the creation of Objects?

Here is a simplified version of the current code, with fewer rows and properties. var row1 = new Object(); var row2 = new Object(); var row3 = new Object(); var row4 = new Object(); var row5 = new Object(); var row6 = new Object(); var row7 = new Object() ...

Tips on how to properly format a date retrieved from a database using the JavaScript function new Date()

I've been grappling with the best method for inserting dates into the database, and currently I'm utilizing new Date(). However, when I query from the database, it returns a date format like this: 2021-09-24T12:38:54.656Z It struck me that this ...

How can I log an object definition and text in the same console.log statement?

Looking for a way to correctly display "obj" in the same string as "note." Here's my JavaScript code: console.log(obj);// [query: "wordOfTheDay"] console.log(note + " : " + obj ); // obj does not show up I want to ensure that "obj" displays properly ...

Implement a timer reset function with JavaScript on a click event

Here is the JavaScript code that I am working with: <script> $(document).ready(function () { window.setTimeout(function () { $('#logout_warning').reveal(); }, 6000) }); $(document).ready(function () { window.setTimeout( ...

Incorporating video.js into an Angular website application

I've encountered a strange issue while attempting to integrate video.js into my angular app. <video id="example_video_1" class="video-js vjs-default-skin" controls preload="none" width="300" height="264" poster="http://video-js.zenco ...

Is there an appropriate method in Vue/Nuxt for managing and altering component data without using lifecycle hooks?

Scenario: I am dealing with a component that showcases a datatable listing Applications. Upon clicking a row, it triggers the opening of another component with appropriately loaded fields (for new or edit). The Challenge: The component loads a reference t ...

In JavaScript, convert an array of objects into an array of arrays of objects, effectively grouping the objects together

How can I convert an array of objects into an array of arrays of objects? The goal is to group the objects in the original array based on specific criteria. Objects that are similar according to these criteria will be placed inside a subarray, which become ...

Is there a way to incorporate a Gif into the background of a three.js project?

function initializeGame() { cubeSize = 200; fieldDepth = 50; fieldWidth = 200; fieldHeight = 200; initObstacles = _ => _; // set the game size var WIDTH = 1000; var HEIGHT = 500; // set camera properties var VIEW_ANGLE = 40, ...

Assigning an interface to a useFetch object in Vuejs 3 and Nuxtjs 3: A step-by-step guide

Need assistance with assigning an interface to a useFetch object in Vuejs 3 Interface export interface ProdutoInterface { codigo: number nome: string } Componente const { data: produto, error } = await useFetch(config.API_BASE_URL+`/produto`) I&apos ...

Validation of dynamically generated name fields using radio button group

CODE: html <form id="myform" type="post"> <fieldset id="myid1"> <input id="entries_8490_burn_id_1" name="entries[8490][burn_id]" value="1" type="radio"/> <input id="entries_8490_burn_id_2" name="entries[8490][burn ...

Is there a more efficient method to send a large quantity of input element data to an API via a POST request?

My current ASP.NET project is utilizing JQuery and Bootstrap for the front-end development. One section of the project requires users to fill out a form with over 30 input elements, which then needs to be sent to a back-end API. Typically, I would use JQu ...

The distinction between client-side and server-side onclick events

I am working on enhancing a composite control's client side functionality by recreating all methods in JavaScript. However, I am facing some issues: Is it possible to trigger the onclick event on the client side instead of the server side? The state ...

Saving the selections from two drop-down menus into a single variable

I have a requirement to store the user selected values from two dropdown menus. These dropdowns are created using the selectize library in HTML: <div style="max-width: 200px"> <select id="dropdown-1" ...

Continue to run upon clicking the button in the Document Object Model

I want the code to constantly change instead of executing only once. By default, the button has a dark mode for text and the background color is pink. When you click the button, the background color changes to black and the text in the button turns into li ...

Determining if a method's timeout has been triggered while running on a periodic basis in JavaScript

Within my JavaScript code, I have implemented a method that runs every 5 minutes. However, after 15 minutes, I want to stop this method from executing. var tChk ; tChk = setInterval("test()", 5*60*1000); setTimeout("timeOut(tChk)", 15*60*1000); // 15 mins ...

Choosing items by pressing "shift + up arrow"

I have a collection of elements, each representing one line of text. When you click on an element, it changes color. If you then hold down "shift + arrow up," the items above it are also selected. How can this functionality be implemented? My initial app ...

What are the steps to resolving an issue with importing a css file in next.js?

Error: ./node_modules/quill-emoji/dist/quill-emoji.css ModuleParseError: Module parse failed: Unexpected character '�' (1:0) You may need a suitable loader for handling this file type, as there are currently no configured loaders to process it. ...