Show all date outside validarange in fullcalender - javascript

I am using fullcalender where I have added validRange property.
After adding user won't be able to navigate outside given daterange also fullcalender will show disable those blocks.
But I want to see Date in those disabled colums.
CodePen Demo
calender options:
var calendar = new FullCalendar.Calendar(calendarEl, {
plugins: [ 'dayGrid' ],
timeZone: 'UTC',
height: 'auto',
events: 'https://fullcalendar.io/demo-events.json?overload-day',
validRange: {
start: '2021-05-01',
end: new Date()
},
});
Current Output:
Expected Output:

Since you set up the end date with today, so it's normal.
Just remove the end: new Date() of validRange:.
You can refer to this codepen.
Good Luck:)

Related

setOption startParam works weird in fullcalendar v5

I was trying to set startParam option dynamically.
But it seems working weird by updating the key rather update value.
calendarEvents.setOption('startParam', moment().format());
calendarEvents.refetchEvents();
If I run the methods and check the form data, then the startParam will be look like the following.
2021-02-15T19:09:13-07:00: 2021-01-01T00:00:00-07:00
end: 2030-01-01T00:00:00-07:00
I guess the setOption method updates the key not value for the start params.
Why does this happen and how to fix this?
UPDATE: My calendar code
calendarEvents = new FullCalendar.Calendar(calendarEventsEl, {
headerToolbar: false,
contentHeight: 300,
initialView: 'listAll',
views: {
listAll: {
type: 'listYear',
duration: { years: 9 },
},
},
navLinks: false,
eventDidMount: function (arg) {
...
},
eventTimeFormat: {
hour: 'numeric',
minute: '2-digit',
meridiem: 'short'
},
eventSources: [{
method: 'POST',
url: '/calendar/get_all_by_id/' + id,
}],
eventSourceSuccess: function(content, xhr) {
...
return events;
}
});
calendarEvents.render();
})
It's working properly.
The startParam option sets the name of the parameter which fullCalendar sends to the server for the start value, when fetching events. It doesn't set the value. The value which is sent is always the start date of the range which the user has just navigated to. You don't need to change that value yourself, and anyway it makes no sense to try and give it a fixed value - it is adjusted dynamically by fullCalendar every time events need fetching.
What are you actually trying to achieve with this code? Are you trying to change the current date on the calendar programmatically? If so then use https://fullcalendar.io/docs/Calendar-gotoDate

How to show all events without range limitation in fullcalendar?

I want to show all events without any limitation in fullcalendar v5.
Here's my code.
document.addEventListener('DOMContentLoaded', function() {
var calendarEventsEl = document.getElementById('calendar-events');
calendarEvents = new FullCalendar.Calendar(calendarEventsEl, {
initialView: 'listMonth',
navLinks: false, // can click day/week names to navigate views
dayMaxEvents: true,
eventTimeFormat: {
hour: 'numeric',
minute: '2-digit',
meridiem: false
},
eventSources: [{
method: 'POST',
url: '/calendar/get_all',
failure: function() {
document.getElementById('script-warning').style.display = 'block'
}
}]
});
calendarEvents.render();
})
At this moment, I can show all events for the month.
If I check the response for eventSources api, the response has all events.
But what I want to do is to show all events without any limitation like week, month, etc.
I tried to change the initialView option to list and tried to set validRange and visibleRange to null.
Any ideas?
When there are too many events, a link that looks like “+2 more” is displayed. The exact action that happens when the user clicks the link is determined by eventLimitClick.
A value of false (the default) will display all events as-is.
A value of true will limit the number of events to the height of the day cell. View a live demo.
An integer value will limit the events to a specific number of rows.
For the all-day section in the TimeGrid views, a value of true will limit the number of events to 5. To fine-tune this, use View-Specific Options like this:
var calendar = new Calendar(calendarEl, {
eventLimit: true, // for all non-TimeGrid views
views: {
timeGrid: {
eventLimit: 6 // adjust to 6 only for timeGridWeek/timeGridDay
}
}
});

FullCalendar display within date range

I am trying to display FullCalendar withing a certain date range. To do so I added the following visibleRange option to my code but it is not working. The calendar is simply not displaying.
this.$calendar.fullCalendar({
//other settings
defaultView: 'basic',
visibleRange: {
start: moment('2017-05-22'),
end: moment('2017-05-29')
},
duration: { days: 7 },
//other settings
});
Any idea how I can achieve this?
Thanks
Using momentjs 2.18.1, jquery 3.2.1, fullcalendar 3.4.0 this shows the view from 5/22 through 5/28:
$('#calendar').fullCalendar({
defaultView: 'basic',
visibleRange: {
start: moment('2017-05-22'),
end: moment('2017-05-29')
} // Don't use duration in combination with visibleRange? Appears to override
/*,
duration: {
days: 7
}*/
});
Demo # https://jsfiddle.net/ez33y8gv/

how to customize jquery-jtable create dialog box

I am creating simple demo CRUD application using jtable jable.org
Jtable contains only two data columns
StartTime and EndTime
I can specify type field as date if I want to show Date-Picker in create modal window, but I don't have any idea how to show datetimepicker in the create modal dialog box.
Can I customize the create modal dialog box in jtable js.
$('#MaintenanceTime').jtable({
jqueryuiTheme: true,
paging: true,
pageSize: 10,
title: 'The Roles are as follows:-',
messages: {
loadingMessage: 'Fetching Data from Server',
addNewRecord: 'Add New MaintenanceTime',
},
actions: {
listAction: '#Url.Action("ListMaintenanceTime")',
updateAction: '#Url.Action("UpdateMaintenanceTime")',
deleteAction: '#Url.Action("DeleteMaintenanceTime")',
createAction: '#Url.Action("AddMaintenanceTime")'
},
fields: {
ATMaintenanceID: {
key: true,
title: 'Id',
create: false,
edit: false,
list: false
},
StartDate: {
title: 'Start Time'
//type: 'datetime',
//displayFormat: 'dd.mm.yy',
},
EndDate: {
title: 'End Time'
//type: 'date',
//displayFormat: 'dd.mm.yy',
},
}
});
Thanks for reviewing my question.
If you want to use a datetime picker (not only date) in the jQuery's jTable plugin for an input in your CRUD actions, there is not dedicated type in the parameters (jtable doc):
password / date / textarea / radiobutton / checkbox / hidden
Because the date format allows only jQuery Datepicker date formats.
A GitHub user has made the following commit to implement the dateTime type: https://github.com/gbisheimer/jtable/commit/e40d9c4bd9c65adb56b43a9c233f65c9bc7a5cb9
You can start from his work to implement your part. It uses the timePicker from Trent Richardson (can be found on GitHub also, here), but as far as I looked, the implementation of G. Bisheimer may not be up to date (timePicker not up to date, latest jTable compatibility?)

Fullcalendar : disableResizing is only working on month view

I put three views in my fullcalendar : month, agendaWeek and agendaDay.
I need to activate drag & drop and forbidden events resizing.
I use this following solution to do that on each render event :
$("#calendar").fullCalendar(
'renderEvent',
{
title: "event name",
editable: true,
disableResizing: true
},
true
);
It's only working in the month view, that is I can drag & drop and resize events in agendaWeek and agendaDay views.
How can I remove resizing in this views ?
Thanks.
I try to use the calendar option durationEditable:false but it did not work. The workaround was to use CSS and hide the resize element:
.fc-resizer.fc-end-resizer {
display: none;
}
place eventStartEditable: false as shown here:
initialView: 'resourceTimeline',
slotMinWidth:1,
eventDurationEditable: false, // Disable Resize
eventStartEditable: false, // disable dreage drop
eventTimeFormat: {
hour: '2-digit',
minute: '2-digit',
hour12: true
},
Its Working,
for More
https://fullcalendar.io/docs/v1/disableResizing
disableResizing is available only as a global setting in FullCalendar. So if you want to disable resizing of all events in the calendar, you simply set the setting when you initialize FullCalendar:
var $calendar = $('#calendar').fullCalendar({
[...]
disableResizing: true,
[...]
});
If you want to disable resizing of specific events, you could take a look at this pull request.
place editable:false as shown here:
header:{
left:'prev,next today',
center:'title',
right: 'agendaWeek, list, rrule'//'month,agendaWeek,agendaDay'
},
editable:false, // place it under header. it worked for me
Works for Version 3

Categories

Resources