FullCalendar JS - get DATE when I click on the grid inside an event

I want to get the date when I click on the grid inside the event .

I tried callback functions.

  • dayClick: inactive inside events.
  • eventClick: No date arguments

Additional Information
I created an AJAX crud for the Event and EventException that are included in the event.
Let's say we have an event on December 20-30, 20XX.
I want to use the exception December 25th 20XX for Christmas.

+4
source share
5 answers

In html, note that we are going to add another event eventClickEx method handler to the current fullcalender.

  eventClickEx: function(jsEvent,ev,view,cellDate){
    alert(cellDate);
  }

fullcalendar.js. . getCellDate, .

 EventPointing.prototype.handleClick = function (seg, ev) {
        var hit = this.view.queryHit(getEvX(ev),getEvY(ev));
        var cellDate =  this.view.getCellDateEx(hit.row,hit.col);
        var res = this.component.publiclyTrigger('eventClickEx', {
            context: seg.el[0],
            args: [seg.footprint.getEventLegacy(), ev, this.view,cellDate]
        });
        if (res === false) {
            ev.preventDefault();
        }
    };

, BasicView, dayGrid.

BasicView.prototype.getCellDateEx = function (row,col){
  return this.dayGrid.getCellDate(row,col);
};

, , cellDate.

+1
0
dayClick: function(date, jsEvent, view) {

  //this will log the date of a certain grid clicked in the console   
  console.log(date) 
}

fullcalendar:

https://fullcalendar.io/docs/dayClick

0

Fullcalendar , , . :

  • , datepicker "/ "... .
  • "/ ", ( ) "" .
  • " ", ( )

, 10 , . .. Youc "", this

0

:

$('#calendar').fullCalendar({
  dayClick: function(date, jsEvent, view) {

    alert('Clicked on: ' + date.format());

  }
});
0

Source: https://habr.com/ru/post/1695034/


All Articles