1

I am using FullCalendar throughout my project and I need to disable dragging, but enable click, I have tried the following code below, but without success

$('#calendar').fullCalendar({
    theme: true,
    header: { 
    left: 'prev,next today',
    center: 'title',
    right: 'month,agendaWeek,agendaDay'
    },
    defaultDate: '2014-01-12', 
    editable: true,
    eventStartEditable: false
});

Edit

It is possible to drag an even and click on the calender day, i need to disable dragging, but when i do, the click event dont fire

dayClick: function(date, jsEvent, view) {
        console.log(
        'Clicked on: ' + date.format + 
        'Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY+
        'Current view: ' + view.name
        );
     }
Cœur
  • 37,241
  • 25
  • 195
  • 267
Smith
  • 5,765
  • 17
  • 102
  • 161

2 Answers2

2

I think you are looking for eventClick.

  $('#calendar').fullCalendar({
    theme: true,
    header: { 
    left: 'prev,next today',
    center: 'title',
    right: 'month,agendaWeek,agendaDay'
    },
    defaultDate: '2014-01-12', 
    editable: false,
    eventClick: function(date, jsEvent, view) {
        alert(
            'Clicked on: ' + date.format + 
            'Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY+
            'Current view: ' + view.name
        );
    }
   });
MarCrazyness
  • 2,172
  • 1
  • 27
  • 28
0

You have to remove the line editable: true,

Here is a working example. use this script tag.

<script>

$(document).ready(function() {

    var date = new Date();
    var d = date.getDate();
    var m = date.getMonth();
    var y = date.getFullYear();
    var Xmas95 = new Date("25 Dec, 1995 23:15:00");
    alert('vidda : '+ Xmas95);
    $('#calendar').fullCalendar({
        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,agendaWeek,agendaDay'
        },
        //editable: true,
        events: [
            {
                title: 'All Day Event',
                start: '20140210'
            },
            {
                title: 'Long Event',
                start: new Date(y, m, d-5),
                end: new Date(y, m, d-2)
            }

        ],
            dayClick: function(date, allDay, jsEvent, view) {

                    alert('Clicked on the entire day: ' + date);
                    console.log(date);

            }
    });

});

 </script>

this should work fine. The dragging facility will cut off by removing editable:true and dayClick can be achieved by the relevant code.

prime
  • 14,464
  • 14
  • 99
  • 131